My 1st Interactive Project
- colleenguirand1
- Sep 20, 2021
- 1 min read
In this project, I used my microbit to create a "Simon Says" game using two LED lights, while implementing a function for button A & B. Before I started, I told the program that what ever value "buttonPV" was needs to be 0 when the program starts. I set some forever conditions where if the button value was one, digital pin 0 would be on and 1 would be off. If it is equal to 2, then both pins stay lit, otherwise, both pins will be off.
After, I started giving functionality to both buttons. For button A, I set a rule that if the button is off then it was pressed, turn the value to 1 or on. If it is on then press it to turn it back to original state or 0. If nothing was pressed, keep off or 0. Button B required a double press action in order to light both pins up so instead of changing value back to 0 after being pressed, it stays lit.
My initial thoughts going to this project was "How will I do this?". I am still new to JavaScript so this was definitely a challenge. I focused a lot of my time on the actual code blocks then the decorative or fun stuff like putting icons and words. I had a hard time reading the code in plain English like how a computer would, but I looked back on notes and built from there.

תגובות