Project 1
Setting Up your LED on the Arduino Board
Components
- 1 Arduino
- 1 LED
- 1 220 ohm resistor (red, red, brown)
- 1 piece of data wire
LED setup on the Arduino Board |
Codes to use on the Arduino IDE
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
int led = 13;
int blinkTime = 1000;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
blinkMe();
}
//blinkme function
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
int led = 13;
int blinkTime = 1000;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
blinkMe();
}
//blinkme function
void blinkMe()
{
digitalWrite(led, HIGH);
delay(blinkTime);
digitalWrite(led, LOW);
delay(blinkTime);
}
Watch A Short Video
If this tutorial was helpful, please do post your comments. Thanks
By Lis Brown.
Hi this is really good. Keep it up
ReplyDeleteYou are doing well lizzy. When you come i suggest you demonstrate to the whole department and the students what you are have learnt.
ReplyDeleteIt will be a big pleasure.
Delete