intro to arduino programming. draw your circuits before you build them from arduino 330 ohm from...

Download Intro to Arduino Programming. Draw your circuits before you build them From Arduino 330 Ohm From Arduino 330 Ohm From Arduino 330 Ohm

Post on 30-Dec-2015

212 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

Guide to Arduino Programming

Intro to Arduino ProgrammingDraw your circuits before you build themFrom Arduino330 OhmFrom Arduino330 OhmFrom Arduino330 OhmUse comments and meaningful variable names

Develop separate pieces of code for each part of your lab or projectBalancing Arduino RobotRead Accelerometer/ GyroscopeEstimate angle of robotSet motor voltageMeasure motor rotationFirst sketch

Make sure you can upload the code blink from examples/basic. If it worked, there should be a light slowly blinking on your Arduino

void setup() and void loop()Your code must have only one function called setup and one called loop but They can be empty

If you only want a piece of code to run once, where should you put it?

if statements

Syntaxif(conditional statement){Your code goes here}

Exampleif(testVal == number)if(testVal < number)if(testVal > number1 && testVal < number2 )

else if and elseSyntaxif(conditional statement){}else if(conditional statement){}else{}

for loopExample:

for(int i = 0; i

Recommended

View more >