arduino:start
Dies ist eine alte Version des Dokuments!
Digitalelektronik Arduino
Workshop an der Fachschaftstagung 2014
Links
Arduino
- Arduino - Offizielle Website
Entwicklungsumgebungen (IDEs)
- Arduino IDE - Offizielle IDE (Java)
- VisualMicro - Arduino IDE für Microsoft Visual Studio
- MariaMole - Open Source IDE für Arduino (Qt)
- UECIDE – Universal Embedded Computing IDE (Java)
Shops
const int DATA_PIN = 0; const int SHIFT_CLOCK_PIN = 1; const int STORAGE_CLOCK_PIN = 2; const int MUSTER[] = { B01111110, B10000001, B10101001, B10000001, B10000101, B10111001, B10000001, B01111110 }; const int DELAY[] = {200, 100, 20, 10, 2, 1}; int DELAY_SIZE = sizeof(DELAY) / sizeof(int); int row = 0; int delayIndex = 0; int changeTime; void setMatrix(byte row, byte col) { digitalWrite(STORAGE_CLOCK_PIN, LOW); shiftOut(DATA_PIN, SHIFT_CLOCK_PIN, LSBFIRST, 1 << (7 - row)); shiftOut(DATA_PIN, SHIFT_CLOCK_PIN, LSBFIRST, col ^ 255); digitalWrite(STORAGE_CLOCK_PIN, HIGH); } void setup() { pinMode(DATA_PIN, OUTPUT); pinMode(SHIFT_CLOCK_PIN, OUTPUT); pinMode(STORAGE_CLOCK_PIN, OUTPUT); changeTime = millis() + 5000; } void loop() { setMatrix(row, MUSTER[row]); row = (row + 1) % 8; delay(DELAY[delayIndex]); if (millis() >= changeTime && delayIndex < DELAY_SIZE-1) { delayIndex = delayIndex + 1; changeTime = millis() + 5000; } }
arduino/start.1416037911.txt.gz · Zuletzt geändert: 2020/10/13 14:25 (Externe Bearbeitung)