10. November 2010
Aufbau gemäss Anleitung auf Physical Computing Website.#define ENABLE 12 #define DIR1 11 #define DIR2 10 int richtung = 1; void setup() { pinMode(ENABLE, OUTPUT); digitalWrite(ENABLE, HIGH); pinMode(DIR1, OUTPUT); digitalWrite(DIR1, HIGH); pinMode(DIR2, OUTPUT); digitalWrite(DIR2, LOW); Serial.begin(9600); } void loop() { if (richtung == 1) { digitalWrite(DIR1, HIGH); digitalWrite(DIR2, LOW); richtung = 2; Serial.print("digitalRead = "); Serial.print(digitalRead(DIR1)); Serial.print(","); Serial.print(digitalRead(DIR2)); Serial.print("richtung = "); Serial.print(richtung); Serial.println(""); } else { digitalWrite(DIR1,LOW); digitalWrite(DIR2, HIGH); richtung = 1; Serial.print("digitalRead = "); Serial.print(digitalRead(DIR1)); Serial.print(","); Serial.print(digitalRead(DIR2)); Serial.print("richtung = "); Serial.print(richtung); Serial.println(""); } delay(2000); }