workshops:arduino_for_the_curious:stage_1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
workshops:arduino_for_the_curious:stage_1 [2017-04-09 21:49] – Simon | workshops:arduino_for_the_curious:stage_1 [2017-04-09 21:52] (current) – 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: | ||
+ | < | ||
// 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, | digitalWrite(13, | ||
- | delay(1000); | + | delay(1000); |
digitalWrite(13, | digitalWrite(13, | ||
delay(1000); | delay(1000); | ||
} | } | ||
+ | </ | ||
Copy this code into your Arduino software and upload it. | Copy this code into your Arduino software and upload it. | ||
Line 87: | Line 87: | ||
Here's your first challenge! Try to complete both tasks. This will help you understand the code. | Here's your first challenge! Try to complete both tasks. This will help you understand the code. | ||
- | | {{workshops: | + | | {{workshops: |
Line 96: | Line 96: | ||
You might already be thinking. How do I know what my program is doing if all the feedback I have is a blinking LED? Well there is a solution in the form of serial communication which allows your Arduino to send messages to a computer. These messages can then be shown on your screen by clicking the button at the top right of the Arduino software. | You might already be thinking. How do I know what my program is doing if all the feedback I have is a blinking LED? Well there is a solution in the form of serial communication which allows your Arduino to send messages to a computer. These messages can then be shown on your screen by clicking the button at the top right of the Arduino software. | ||
- | Note: when handling textual information in the Arduino programming language you need to use double quote marks. In this programming language " | + | Note: when handling textual information in the Arduino programming language you need to use double quote marks. In this programming language |
- | + | ||
+ | < | ||
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(" | Serial.println(" | ||
- | |||
} | } | ||
Line 115: | Line 113: | ||
Serial.println(" | Serial.println(" | ||
digitalWrite(13, | digitalWrite(13, | ||
- | delay(1000); | + | delay(1000); |
Serial.println(" | Serial.println(" | ||
digitalWrite(13, | digitalWrite(13, | ||
delay(1000); | delay(1000); | ||
} | } | ||
+ | </ | ||
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.1491774541.txt.gz · Last modified: 2017-04-09 21:49 by Simon