Sha256: 898f071c06e7410bab19a6859be7f63a0b016fca0dfad30224c793dd9da3c00e
Contents?: true
Size: 633 Bytes
Versions: 1
Compression:
Stored size: 633 Bytes
Contents
int LENGTH = 3; int ledPins[] = {12, 11, 10}; int buttonPins[] = {5, 4, 3}; int channelIds[] = {0, 32, 8}; void setup() { Serial.begin(9600); for (int i = 0; i < LENGTH; ++i) { pinMode(ledPins[i], OUTPUT); pinMode(buttonPins[i], INPUT); } } void loop() { for (int i = 0; i < LENGTH; ++i) { if (digitalRead(buttonPins[i])) { turnOnLed(i); } } delay(1); } void turnOnLed(int which) { for (int i = 0; i < LENGTH; ++i) { if (i == which) { digitalWrite(ledPins[i], HIGH); Serial.print(channelIds[i]); } else { digitalWrite(ledPins[i], LOW); } } delay(1000); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
douban.fm.arduino-0.0.1 | douban_fm.ino |