Hello world in Arduino IDE

Tasks:

  1. Make a very simple program like setting the digital output bit D3 to logical state 1 or HIGH.
void setup() {
  // put your setup code here, to run once:
  pinMode(3, OUTPUT);
  digitalWrite(3, HIGH);
}

void loop() {
  // put your main code here, to run repeatedly:

}

: Hello World in ArduinoIDE. {#lst:170_Hello_World_in_ArduinoIDE}

  1. Send the program to controller Arduino UNO .

Questions:

  1. Explain the purpose of next programming characters in presented example:
    1. ;
    2. { }
    3. pinMode(3, OUTPUT);
    4. digitalWrite(3, HIGH);
    5. // put your ...
    6. void setup()
    7. void loop()

Summary:

Using curly braces - { and }

Using curly braces in C++ is important part of writing the programming code. Imagine that you want to merge several members of programming code to a single pile. As we would separate pencils into one pile and markers to another - to be more organized. In real life we would do by elastic bundle or rope. If you have to choose single character from the keyboard to indicate that several members are combined to the same pile - which character would you choose? Probably curly braces {} are the best choice.

Function Name

Function name should be stacked together from 2 - 5 short words that uniquely describing the functionality of the function. The first word should start with lower case and all the others words following should start with upper case. Some examples should be:

badname(); 
goodFunctionName(); 

Function Declaration

int measre_Temperature_Avg(int temperatureSensor);

Function Definition

void loop() {
    //some programming
    //code goes here...
}

Function Call

    digitalWrite(3, HIGH);

Issues:

Error: expected ‘;’ before ‘something’

Probably you forgot to put ; (semicolon) at the end of the command. Find the row starting with "something" and look the row above... probably missing ";".

Light at the digital output D3 is not ON.

Check if the enable switch fot the digital outputs is at the right position (ENABLE).