After going to the Arduino site to install and test your software and programming connection, this chapter guided you through several programming activities. These example sketches showed you how to make your microcontroller do some common tasks, introduced many programming concepts, and suggested a couple of good habits to develop your computer skills.
Serial.print("the value of i = "); Serial.println(i);
long bigVal = 80000000;
if(myVar % 2 == 0) { Serial.println("The variable is even. "); } else { Serial.println("The variable is odd. "); }
for(int i = 21; i <= 39; i+=3) { Serial.print("i = "); Serial.println(i); }
char c = "a"; Serial.print("Character = "); Serial.print(c); Serial.print(" ASCII value = "); Serial.println(c, DEC);
for(char c = 'A'; c <='Z'; c++){}
// Robotics with the BOE Shield - Chapter 1, Project 1 void setup() { Serial.begin(9600); for(char c = ' '; c <= '~'; c++) { Serial.print("Character = "); Serial.print(c); Serial.print(" ASCII value = "); Serial.println(c, DEC); } Serial.println("All done!"); } void loop() { // Empty, no repeating code. }
// Robotics with the BOE Shield - Chapter 1, Project 2 void setup() { Serial.begin(9600); int a = 20; if(a % 2 == 0) { Serial.print("a is even"); } else { Serial.print("a is odd"); } } void loop() { // Empty, no repeating code. }