150 likes | 593 Views
Arduino Part 2. Topics: Programming Constructs: loops & conditionals Digital Input. Trying Something New. Scratch is a project of the Lifelong Kindergarten Group at the MIT Media Lab. S4A is a Scratch modification that allows for simple programming of the Arduino.
E N D
Arduino Part 2 Topics: Programming Constructs: loops & conditionals Digital Input
Trying Something New • Scratch is a project of the Lifelong Kindergarten Group at the MITMedia Lab. • S4A is a Scratch modification that allows for simple programming of the Arduino
Installing and Running S4A (S4A is already installed on the lab computers but you must still install the firmware.) • Download The S4A firmware from here • Connect your Arduino board to a USB port in your computer • Open the Arduino IDE • Open the firmware file (S4AFirmware15.ino) in the Arduino IDE • In the Tools menu, select the board version and the serial port • Load the firmware into your board using Tools > Upload • Open the S4A program
Conditional Statement if (someCondition) { // do stuff if the condition is true} else { // do stuff if the condition is false} modelect.wordpress.com
while Loop while(expression){ statement(s); } Example int var = 0;while (var < 200) { // do 200 times var = var + 1;} www.toves.org
for loop www.visualcplusdotnet.com martin-thoma.com
Digital Input (introducing the switch) Create the circuit above and then run File -> Examples -> Digital -> Button push-button switch www.ladyada.net/