Entfernungsschalter
//Arduino PWM Speed Control:
int E1 = 6;
int M1 = 7;
int E2 = 5;
int M2 = 4;
int pin = 12;
void setup() {
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
pinMode(pin, INPUT);
}
void loop() {
if(digitalRead(pin) == HIGH) {
int value;
//for(value = 0 ; value <= 255; value+=5) {
digitalWrite(M1,LOW);
digitalWrite(M2, LOW);
analogWrite(E1, 0); //PWM Speed Control
analogWrite(E2, 0); //PWM Speed Control
//delay(30);
}
else {
digitalWrite(M1, HIGH);
digitalWrite(M2, HIGH);
analogWrite(E1, 200-54); //PWM Speed Control
analogWrite(E2, 200);}
}
Erstellt: Carl Georg Boos (27.02.2014)
Letzte Änderung: Andreas Hecker (27.03.2014)