This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot-open:programming_fundamentals_rtu:building_your_first_project [2018/01/16 09:23] – Agrisnik | en:iot-open:programming_fundamentals_rtu:building_your_first_project [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 143: | Line 143: | ||
| ===== Hello World ===== | ===== Hello World ===== | ||
| + | "// | ||
| + | Here is the //Hello World// program for Arduino that outputs the text on the Serial Monitor each second: | ||
| + | <code c> | ||
| + | void setup() { | ||
| + | Serial.begin(9600); | ||
| + | } | ||
| + | void loop() { | ||
| + | Serial.println(" | ||
| + | delay(1000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Serial Monitor can be found following the path: // | ||
| + | |||
| + | In the code can be seen that the //setup()// function contains the following command: | ||
| + | <code c> | ||
| + | Serial.begin(9600); | ||
| + | </ | ||
| + | This statement opens the serial port at the initialization of the program so that the Serial Monitor can be used for outputting text or values on the screen. | ||
| + | |||
| + | For printing out text the following command is used: | ||
| + | <code c> | ||
| + | Serial.println(" | ||
| + | </ | ||
| + | |||
| + | **Check yourself** | ||
| + | |||
| + | 1. How to attach any library to a sketch? | ||
| + | |||
| + | 2. What command expressions are not usually separate by semicolon? | ||
| + | |||
| + | 3. How to establish a serial communication between devices? | ||
| + | |||
| + | 4. How does delay() command works? | ||
| + | |||
| + | *Stops LED blinking specified number of milliseconds | ||
| + | |||
| + | *Stops program execution for a specified number of seconds | ||
| + | |||
| + | *Stops program execution for a specified number of milliseconds | ||