Stap 5: Random getal-Generator met Led staafdiagram.
<p>int LED0 = 2;<br>int LED1 = 3; int LED2 = 4; int LED3 = 5; int LED4 = 6; int LED5 = 7; int LED6 = 8; int LED7 = 9; int LED8 = 10; int LED9 = 11;</p><p>long randomNumber;</p><p>void setup() { Serial.begin(9600);</p><p>Serial.println("Randon Numbernesssssss");</p><p>pinMode(LED0, OUTPUT); pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); pinMode(LED3, OUTPUT); pinMode(LED4, OUTPUT); pinMode(LED5, OUTPUT); pinMode(LED6, OUTPUT); pinMode(LED7, OUTPUT); pinMode(LED8, OUTPUT); pinMode(LED9, OUTPUT);</p><p>randomSeed( analogRead(A0) );</p><p>}</p><p>void loop() { randomNumber = random(2,12);</p><p>Serial.println(randomNumber);</p><p>digitalWrite(randomNumber,HIGH);</p><p>delay(40);</p><p>digitalWrite(randomNumber,LOW);</p><p>}</p><p> This code will make it so when you connect the led or the bar graph to the Arduino it will make random numbers, and the number it makes is the pin number on the Arduino.</p> say something if you need help with anything.