An LED stands for “light emitting diode” It gives off light and uses little power. It has two states, on and off, the state it is in can be controlled by “digitalWrite”
To start programming your LED you will need to make a variable for the pin number you are using to connect to the LED. This can be done with the “Int” command.
Next, in void setup you will need to set the pin you are using to output. Use “pinMode” to do this.
Once you are done with that, Use “digitalWrite” to put a high value into your pin. When it is high it will power the led. Low will turn it off.
The code should look somewhat like this:
int LED1 = 12; //Makes LED1 set to pin 12 void setup() { pinMode(LED1, OUTPUT); //sets LED1 to output } void loop() { digitalWrite(LED1, HIGH); }
If you want the LED to blink, in the loop add a delay, then set the value to low.
It would look something like:
//----------- void loop() { digitalWrite(LED1, HIGH); delay(500); digitalWrite(LED1, Low); delay(500); }