This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A Processing sketch takes an analog input from the serial bus and uses it to scale a color a rectangle. | |
*/ | |
import processing.serial.*; | |
// this selects the port number for your computer. If the code has trouble, try | |
// changing this value to a number between 0 and 9 | |
int portNum = 3; // selects the port number | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
An Arduino sketch that reads an analog input from pin A0 and writes a '0' or '1' to the serial bus. | |
*/ | |
void setup() { | |
Serial.begin(9600); | |
Serial.println("SERIAL READY"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A Processing sketch takes a digital input from the serial bus and uses it to scale a color a rectangle. | |
*/ | |
import processing.serial.*; | |
// this selects the port number for your computer. If the code has trouble, try | |
// changing this value to a number between 0 and 9 | |
int portNum = 3; // selects the port number | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
An Arduino sketch that reads a digital input from pin A0 and writes a '0' or '1' to the serial bus. | |
*/ | |
void setup() { | |
Serial.begin(9600); | |
Serial.println("SERIAL READY"); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a comment block. | |
Anything between the start and end symbols is ignored by the compiler. | |
*/ | |
// This is an in-line comment. Anything after the start symbol is ignored by the compiler (as long as it is on the same line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int myNum; // declares an integer named myNum | |
myNum= 13; // sets the integer named myNum equal to 13 | |
int myNum= 13; // simultaneously declares an integer named myNum and sets it equal to 13 | |
float myDec; // declares a decimal named myDec | |
myDec= 13.001; // sets the decimal named myDecequal to 13.001 | |
float myDec= 13; // simultaneously declares a decimal named myDecand sets it equal to 13 | |
char theChar; // declares a character named theChar | |
theChar = ‘a’; // sets the character named theChar equal to the letter ‘a’. Notice that the character is surrounded my apostrophes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int age = /* some user input*/; | |
if( condition_1 ) { | |
// if condition_1 is true, then do some stuff here and skip all the else clauses | |
} else if( condition_2 ) { | |
// if condition_1 is false but condition_2 is true, then do some stuff here then skip the last else clause | |
} else { | |
// if condition_1 and condition_2 are false, then do stuff here | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int i = 0; | |
while(i<10) { | |
Serial.print("I am on # "); | |
Serial.println(i); | |
i = i+1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( age > 55) { | |
Serial.println("You are a Senior Citizen"); | |
} | |
if( age >= 13 && age <= 19) { | |
Serial.println("You are a teenager"); | |
} | |
if( age < 13 || age > 65 ) { | |
Serial.println("Your either too old or too young to be playing with an Arduino"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doGet() { | |
var app = UiApp.createApplication(); | |
var label = app.createLabel("Hello World"); | |
app.add(label); | |
return app; | |
} |
OlderNewer