Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot-open:programming_fundamentals_rtu:building_your_first_project [2018/01/16 09:23] Agrisniken: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 =====
 +"//Hello World//" program is the simplest program, because it simply outputs the text to the screen.
 +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); //establishes the connection with the serial port
 +}
  
 +void loop() {
 +  Serial.println("Hello World"); //prints out the line with the text
 +  delay(1000);                   //pause for 1 second
 +}
 +</code>
 +
 +Serial Monitor can be found following the path: //Tools->Serial Monitor//.
 +
 +In the code can be seen that the //setup()// function contains the following command:
 +<code c>
 +Serial.begin(9600);
 +</code>
 +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("Hello World");
 +</code>
 +
 +**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
  
en/iot-open/programming_fundamentals_rtu/building_your_first_project.1516094586.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0