Skip to content | Skip to navigation
Powered by RSPowered by RSPowered by RS

Arduino - Hello World

Information type: Software Code
Keywords: Arduino, Hello World, serial
Manufacturer: Arduino
Product: Dev Kit
Technology: Software
Theme: Arduino

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

About the author

peterjfrancis: Head of Design at ebm papst UK Ltd Mechanical Design engineer with a background in defence and aerospace. Experience in electronics packaging, system design, software (PHP, C & C#), MCAD/ECAD integra…

Associated products and knowledge

26 May 2011
Knowledge
14 Sep 2010
Knowledge
19 Nov 2011
Knowledge

Contribute

Like to share knowledge with the community or ask a question relating to this knowledge?