PowenKo > Hardware > Arduino > random

February 7, 2012   ·   0 Comments

 
long randNumber1;
 
long randNumber2;
 
void setup(){
 
Serial.begin(9600);
 
randomSeed(analogRead(0));
 
}
 
void loop(){
 
   randNumber1 = random(300);
 
   Serial.print("Number1 = ");
 
   Serial.println(randNumber1);
 
   randNumber2 = random(10, 20);
 
   Serial.print("Number2 = ");
 
   Serial.println(randNumber2);
 
   delay(2000);
 
}


Read More: http://arduino.tw/allarticlesindex/2009-09-06-18-37-08/282-randnumber.html#ixzz1ljtFrAD2 
Arduino.TW 
Under Creative Commons License: Attribution Non-Commercial No Derivatives
shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Hardware22

Hardware

Amazon

adsbygoogle

Recent Posts

Categories

Amazon