Start it UP!

Nightlight: Stage 1

You will need

This animation shows the steps for this stage
stage 1 GIF

1) The first step is to ensure the Arduino Software has been installed on your computer. This is something for the teacher/demonstrator to do. Check with them that it has been done.

Step 2image

2) Plug the LED into the breadboard with the 2 pins in different rows.

Step 3 image

3) Plug the resistor into the breadboard with one end of the resistor on the same row as one pin of the LED.

Step 4 image

4) Plug one end of the black cable into the breadboard in the same row as the end of the resistor not plugged into the LED.

Step 2image

5) Plug one end of the red cable into the breadboard in the same row as the end of the LED not plugged into the resistor. Your breadboard should look like the picture below.

steps 6 and 7

6) Plug the other end of the black cable into the pin labelled GND (ground) on the side of the Arduino board labelled “Digital (PWM~)”.

7) Plug the other end of the red cable into any one of the pins labelled 2-13 on the Arduino board (remember the number of the pin you’ve used).

mini-usb end. Picture by Anil Öztas

8) Plug the Arduino board into your computer using the mini-USB cable.

Picture by Anil Öztas

9) Open the Arduino Software. Ask your demonstrator if you cannot find it. Open a new file and delete the text in the window. Copy and paste the following text (code) into the window (Need help? Ask your demonstrator):

int LED_Pin = 3; //change to the pin your LED is connected with

void setup() {
    pinMode(LED_Pin, OUTPUT);
}

void loop() {
    digitalWrite(LED_Pin, HIGH); //turns LED on
}




10) Change the LED_Pin = __ to the number of the pin you plugged your red (positive) cable into on the Arduino board (ie. change the ‘3’ to the correct value for your Arduino board). Using the Arduino software, go Sketch > Verify/Compile to compile your code and go File > Save and save it as “nightlight.ino”. Next go Sketch > Upload to send it to your Arduino board. Once this has been completed, and program should return “Done uploading” and your light should switch on!

Not Working? Try This!

  1. Take the LED out, turn it round, and plug it back in the same place. Does the light work now?
  2. Check your code.
    1. Does it compile? If not check the brackets, extra letters etc that are out of place.
    2. Is it identifying the correct LED_Pin number? Check that “int LED_Pin = " has the number that you plugged the red cable into on the Arduino board.
  3. Check the connections on the breadboard.
    1. Check your breadboard looks like the picture at the end of step 4. If it does and your light is still not working, check that:
      1. All the pins are pushed in.
      2. Try using a different LED.
      3. Try using different red and black cables.
      4. If none of that gets your light working, ask your teacher/demonstrator for assistance.

Next stage