box-o-sand/oldstuff/arduino/msaqsg/ch03/BinaryDice/BinaryDice.ino

23 lines
467 B
Arduino
Raw Normal View History

2013-12-30 03:03:12 +00:00
const unsigned int LED_BIT0 = 10;
const unsigned int LED_BIT1 = 11;
const unsigned int LED_BIT2 = 12;
void outputResult(const long result) {
digitalWrite(LED_BIT0, result & B001);
digitalWrite(LED_BIT1, result & B010);
digitalWrite(LED_BIT2, result & B100);
}
void setup() {
pinMode(LED_BIT0, OUTPUT);
pinMode(LED_BIT1, OUTPUT);
pinMode(LED_BIT2, OUTPUT);
randomSeed(analogRead(A0));
outputResult(random(1, 7));
}
void loop() {
}