Willkommen auf unserem Seminar-Blog

Immer auf dem aktuellen Stand bleiben

Dieser Seminar-Blog befindet sich noch im Aufbau und wird in den kommenden Tagen entsprechend verfeinert.

Member Login

Lost your password?

Registration is closed

Sorry, you are not allowed to register by yourself on this site!

You must either be invited by one of our team member or request an invitation by email at viad.info {at} zhdk {dot} ch.

H-Bridge

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);

}