Assignment 3: scared myself into winging it
- Angela Maure
- Feb 5, 2019
- 2 min read
I was very afraid to attempt experimenting for this week's assignment, as I missed a the technical instructions last Thursday. Even though I have instructional notes from last Tuesday's class for future reference, and had access to both the notes & example code from class, I found the new section of coding to be intimidating.
Finally, I gave it a shot. I went through last Tuesday's notes to create the circuit (I believe that's the term) in which the LED is connected to one of the pins connected to the micro:bit and not to the 3v. Then, I repeated the process to have both pins 0 & 1 connected to the LEDs, resulting in what's shown below.

After that, I transferred the Week 2 example code from class to my micro:bit. I played around with pressing the buttons while reading the order of the code:

Pressing button A will make both LEDs light up, button B would light up the LED connected to pin 0, and both A&B would have neither of them light up. I came to understand that P0/P1 indicate which pin I would want to perform the variable, the button variable indicating the set outcome (in this case, what effect it will have on the LEDs), and - within the digital write pin - variable 0 would mean the LED connected to the pin won't light up while 1 means that it will.
I re-ordered the numbers within the variables just so I could look at it better, and came up with the following code:

I'm looking at it again, and it now it looks like a very basic order - it's of course not that much different from the first. But when it resulted in the outcome shown below, I was just very happy to have gotten both the circuit and the coding the way I wanted.
Comments