This lesson will show you how to turn an LED on the Arduino on and off.
pinmode(pin,direction) digitalwrite(pin,level)
Move the mouse over a dotted box for more information.
Now you try. Can you figure out how to turn the LED on? Off?
Type your code here:
See your results here:
If you have your own LED, insert it directly into the Arduino between pin 13 and GND. If you don't have an LED, that's OK. There's a orange LED built right onto
the Arduino board, which is connected to pin 13.
If inserting your own LED, be sure the longer lead is inserted into pin 13, and the shorter into GND. Alternatively, be sure the lead closest to flat edge on the plastic case is
inserted into GND and the other into pin 13.
This code will configure pin 13 as an output pin and then send a digital level to it. If you send
a HIGH to 13, you should see the yellow LED on the Arduino, near pin 13 turn on. If you send a LOW, the LED should go off.
Here is what your Arduino assembly might look like for this lesson:
Note if you don't have an LED, pay attention to the yellow square labeled "L" on your Arduino (also shown in this image).
Share your code
Show a friend, family member, or teacher what you've done!