User Tools

Site Tools


workshops:arduino_for_the_curious:stage_1

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
workshops:arduino_for_the_curious:stage_1 [2017-04-09 21:49] Simonworkshops:arduino_for_the_curious:stage_1 [2017-04-09 21:51] Simon
Line 60: Line 60:
 We now write our first program to make it blink. Here's the program code: We now write our first program to make it blink. Here's the program code:
  
 +<code>
 // Any text after two forward slashes is ignored by computers // Any text after two forward slashes is ignored by computers
 // These are called comments and are used to put notes for people inside code.  // These are called comments and are used to put notes for people inside code. 
Line 73: Line 73:
 void loop() { void loop() {
   digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)   digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
-  delay(1000);               // wait for 1000milli seconds (1 second)+  delay(1000);               // wait for 1000 milliseconds (1 second)
   digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW   digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
   delay(1000);               // wait for a second   delay(1000);               // wait for a second
 } }
 +</code>
  
 Copy this code into your Arduino software and upload it.  Copy this code into your Arduino software and upload it. 
Line 98: Line 98:
 Note: when handling textual information in the Arduino programming language you need to use double quote marks. In this programming language "digitalWrite" represents text (d followed by an i, followed by a g, and so on, spelling the word digitalWrite), whereas digitalWrite (without the double quotes) is a reference to a feature of the programming language which allows you to control the voltage on various pins. Note: when handling textual information in the Arduino programming language you need to use double quote marks. In this programming language "digitalWrite" represents text (d followed by an i, followed by a g, and so on, spelling the word digitalWrite), whereas digitalWrite (without the double quotes) is a reference to a feature of the programming language which allows you to control the voltage on various pins.
  
- +<code>
 void setup() {                 void setup() {                
   // initialize the digital pin 13 as an output, in has the LED connected   // initialize the digital pin 13 as an output, in has the LED connected
Line 108: Line 107:
   // Sends a line to the computer   // Sends a line to the computer
   Serial.println("Hello World!");   Serial.println("Hello World!");
- 
 } }
  
Line 115: Line 113:
   Serial.println("LED On");   Serial.println("LED On");
   digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)   digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
-  delay(1000);               // wait for 1000milli seconds (1 second)+  delay(1000);               // wait for 1000 milliseconds (1 second)
   Serial.println("LED Off");   Serial.println("LED Off");
   digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW   digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
   delay(1000);               // wait for a second   delay(1000);               // wait for a second
 } }
 +</code>
  
 Once you've uploaded the program, open the Serial monitor: Once you've uploaded the program, open the Serial monitor:
Line 130: Line 128:
 So that's the end of the 1st lesson. So that's the end of the 1st lesson.
  
-Once the rest of the group has got to this point there will be another short presentation on programming concepts before moving onto [[stage_2|Tutorial 2]]+Once the rest of the group has got to this point there will be another short presentation on programming concepts before moving onto [[stage_2|Tutorial 2]].
  
workshops/arduino_for_the_curious/stage_1.txt · Last modified: 2017-04-09 21:52 by Simon

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki