Commit ebd10165 authored by Daniel STAN's avatar Daniel STAN

lotus: ajout du relai et debug

parent 495d559b
......@@ -6,8 +6,13 @@ avec programme python coté port série*/
#define RF_M_DRV1 11 //3A
#define RF_M_DRV2 10 //4A, ex 12
// Pin relai ampoule
#define PIN_BULB 9
// Pin pour mesurer la position
#define PIN_POS A0
#define POS_HIGH 280
#define POS_LOW 107
#define BOUNCE 3
......@@ -20,6 +25,8 @@ void setup()
pinMode(RF_M_CONT, OUTPUT);
pinMode(RF_M_DRV1, OUTPUT);
pinMode(RF_M_DRV2, OUTPUT);
pinMode(PIN_BULB, OUTPUT);
digitalWrite(PIN_BULB, HIGH);
digitalWrite(RF_M_CONT, LOW);
digitalWrite(RF_M_DRV1, LOW);
digitalWrite(RF_M_DRV2, LOW);
......@@ -79,13 +86,18 @@ void loop() {
int incomingByte = 0;
if(Serial.available()) {
incomingByte = Serial.read();
Serial.print("Read");
Serial.println(incomingByte);
if(incomingByte == '0')
move(false);
else if(incomingByte == '1')
move(true);
else if(incomingByte == 'r') {
else if(incomingByte == 'r')
report_pos();
}
else if(incomingByte == 'o')
digitalWrite(PIN_BULB, LOW);
else if(incomingByte == 'f')
digitalWrite(PIN_BULB, HIGH);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment