Sha256: 8be68f203b1375d0017369b3eef59a1c192f597ec8310b731459949e778ece12
Contents?: true
Size: 666 Bytes
Versions: 1
Compression:
Stored size: 666 Bytes
Contents
int LENGTH = 3; int ledPins[] = {12, 11, 10}; int buttonPins[] = {5, 4, 3}; int channelIds[] = {0, 32, -1}; 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])) { switchChannel(i); } } delay(1); } void switchChannel(int which) { for (int i = 0; i < LENGTH; ++i) { if (i == which) { digitalWrite(ledPins[i], HIGH); Serial.println(channelIds[i]); Serial.flush(); } else { digitalWrite(ledPins[i], LOW); } } delay(1000); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
douban.fm.arduino-0.1.1 | douban_fm/douban_fm.ino |