Arduino - Hello World
Contributed by peterjfrancis
Overview
This is the classic Hello World for the Arduino. (See attached code file)
I've added a slight twist by sending the LED status to the serial port.
See my Blog --> http://www.designspark.com/peterjfrancis for further details
Details
/*
Hello World
Function
Turns on an LED on for one second, then off for one second, repeatedly.
Outputs the current status to the serial port
Peter J Francis
*/
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards
// Set up the serial port for comms @ 9600 baud
pinMode(13, OUTPUT); // set the pin as an OUTPUT
Serial.begin(9600); // Opens serial port and sets it to 9600baud
}
void loop() {
// this loop runs continuiously
digitalWrite(13, HIGH); // set the LED on
Serial.println("LED is ON"); // sends LED is ON to the serial port
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
Serial.println("LED is OFF"); // sends LED is OFF to the serial port
delay(1000); // wait for a second
}
Supporting Materials
| Title | Information type |
|---|---|
| Hello World for the Arduino | Software Code |
Related blog posts
Associated products and knowledge
Questions and answers
Contribute
Like to share knowledge with the community or ask a question relating to this knowledge?
