Create a new Project
- Open the Arduino IDE
- Click on File
- Then New
- Highlight everything ( By Pressing Command-A )
- Paste the following code
/*
Blink
Turns an LED on for one second, then off for one second, repeatedly.
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
#define LED2_DATA_PIN 16
pinMode(LED_BUILTIN, OUTPUT);
pinMode(LED2_DATA_PIN, OUTPUT);
Serial.begin(115200);
Serial.println("Setup done");
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(LED2_DATA_PIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
Serial.println(LED_BUILTIN);
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
digitalWrite(LED2_DATA_PIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Save the Program
- Click on the File Menu again
- Then Chose Save As
- Type in "Blink Both Leds"
Upload the Sketch
- Click on the Sketch Menu
- Then Upload.
Taken from this web site
Arduino Example Site