Adding a Second LED

I began by plugging in the second LED into the arduino board; the positive leg of the diode (longer one) was plugged into the 5th pin slot and the board. The negative leg needs to be plugged into a jumper lead in order to reach the GND pin for the circuit to be completed.

Jumper leads consist of a female and a male end and are used to lengthen the positive or negative legs of the diodes.

I then added the code for the second LED. In order to do this, I added the line “pinMode(5,OUTPUT);” in the void setup() section of the code. The aim of this is to note the 5th pin of the board as an output (LED).

I then copied the first LED blink code and pasted it below the original code. In order to set the code to the second LED (on pin 5) I changed the 13 with a 5 in the line “digitalWrite(13,HIGH);” the aim of this is to apply this code to the 5th pin instead of the 13th pin.

Following this, I then uploaded the code to the board. However it didn’t initially work as only the first LED (13th pin) would blink. In order to fix this, myself and Poppy tried replacing the different components in different configurations in order to understand if any of them were faulty. After trying different configurations, we could see that all the components worked and so it seemed to either be an issue with the board or the uploading process.

 

Finally, we tried changing the port destination. we realised that I was trying to upload the code via the wrong port (COM3). Once we had changed the port, the code uploaded successfully and the two LED blinked in succession.

Following this, I played with the code in a similar way to last time to the blink sketch. Again, this doubled the time the LED blinked for.

Print Friendly, PDF & Email

Leave a Reply