Arduino_Tell_The_Fortune. New fun codes composed by Simon.

Simon spent most of the day coding, with a break to have his Chinese lesson. It turned out that he was composing his one codes. It was very frustrating when some of them didn’t work and gave complex error messages but several did. Here are two examples of his latest inventions:

/*
Random_Arduino_Serial_Selection
// This will allow you to press a button to get a random number.
// The random module is effecting the random number.
// To see the random number, Click the Serial monitor above.
*/
int random1 = A0;
int button = (digitalWrite, random1);

void setup(){

Serial.begin(9600);
pinMode(random1, INPUT);
pinMode(button, INPUT);

}

void loop(){

Serial.println(analogRead(random1));

}

Arduino_Tell_The_Fortune
// ask a question to the Arduino.
// The sound trigger triggers the circuit whenever someone asks a question.

*/

int trigger = A0;

void setup(){

Serial.begin(9600);
pinMode(trigger, INPUT);

}

void loop(){

delay(2000);
Serial.println(“true” or”false”);

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s