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:47] – Simon | workshops:arduino_for_the_curious:stage_1 [2017-04-09 21:52] (current) – Simon | ||
---|---|---|---|
Line 17: | Line 17: | ||
First, we need to wire up the breadboard' | First, we need to wire up the breadboard' | ||
- | * Using a blue or black wire connect one of the GND pins on the Arduino to the Blue rail on the left of the breadboard. | + | * Using a blue or black wire connect one of the GND pins on the Arduino to the blue rail on the left of the breadboard. |
- | * Using a red wire connect 5V on the Arduino to the Red rail on the right hand side on the breadboard | + | * Using a red wire connect 5V on the Arduino to the red rail on the right hand side on the breadboard |
Once you've done this the breadboard and Arduino should look like this. | Once you've done this the breadboard and Arduino should look like this. | ||
Line 38: | Line 38: | ||
Remember: With [[resistors|resistors]] it doesn' | Remember: With [[resistors|resistors]] it doesn' | ||
- | * Now you plug the Arduino into your computer with the USB cable, it should start providing power to the breadboard, lighting up the LED. If the LEDs doesn' | + | * Now you plug the Arduino into your computer with the USB cable, it should start providing power to the breadboard, lighting up the LED. If the LED doesn' |
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.1491774466.txt.gz · Last modified: 2017-04-09 21:47 by Simon