/*
* Project: Random-numbers_task_35
* Author: Jane-Maree Howard
* Date: Wednesday 24/03/2010
* Platform: Arduino 18
* Purpose: To generate 100 random numbers from 0-9 inclusive,
* label them 1-100 & output them to the
* Serial Monitor (SM)
*/
long randNumber; //random number to SM
//set up random number seed & baud rate to SM
void setup()
{
Serial.begin(9600);
randomSeed(analogRead(0));
}//end setup()
//generates 100 random numbers 0-9 inclusive
void loop()
{
Serial.println("\n100 random numbers");
delay(30);
for (int j=1; j<=100; j++) { randNumber = random(10); // random number from 0-9 Serial.print(j); Serial.print(".\t"); Serial.println(randNumber); delay(10); }//for (j++) delay(500); }//end loop()
24 March 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment