Commit 8346abe0 authored by Daniel STAN's avatar Daniel STAN

lotus de la soirée

parent df6afbff
......@@ -8,6 +8,12 @@ avec programme python coté port série*/
#define RF_M_DRV1 11
#define RF_M_DRV2 12
#define PIN_POS A0
#define POS_HIGH 262
#define POS_LOW 105
#define BOUNCE 20
#include <IRLib.h>
......@@ -30,8 +36,8 @@ void setup()
pinMode(RF_M_DRV1, OUTPUT);
pinMode(RF_M_DRV2, OUTPUT);
digitalWrite(RF_M_CONT, HIGH);
digitalWrite(RF_M_DRV1, LOW);
digitalWrite(RF_M_DRV2, HIGH);
digitalWrite(RF_M_DRV1, HIGH);
digitalWrite(RF_M_DRV2, LOW);
}
......@@ -39,12 +45,40 @@ void setup()
void loop() {
int val;
int incomingByte = 0;
delay(1000);
digitalWrite(RF_M_DRV1, LOW);
digitalWrite(RF_M_DRV2, HIGH);
delay(1000);
digitalWrite(RF_M_DRV2, LOW);
digitalWrite(RF_M_DRV1, HIGH);
bool going_up = true;
val = analogRead(PIN_POS);
// if(val > POS_HIGH + BOUNCE && going_up) {
// Serial.println(val);
// Serial.println("Going down");
// digitalWrite(RF_M_CONT, HIGH);
// digitalWrite(RF_M_DRV1, LOW);
// digitalWrite(RF_M_DRV2, HIGH);
// going_up = false;
// } else if( val < POS_LOW - BOUNCE && !going_up) {
// Serial.println(val);
// Serial.println("Going up");
// digitalWrite(RF_M_CONT, HIGH);
// digitalWrite(RF_M_DRV1, HIGH);
// digitalWrite(RF_M_DRV2, LOW);
// going_up = true;
// }
if(Serial.available()) {
incomingByte = Serial.read();
if(incomingByte == '0') {
Serial.println("Going down");
digitalWrite(RF_M_CONT, HIGH);
digitalWrite(RF_M_DRV1, LOW);
digitalWrite(RF_M_DRV2, HIGH);
} else
if(incomingByte == '1') {
Serial.println("Going up");
digitalWrite(RF_M_CONT, HIGH);
digitalWrite(RF_M_DRV1, HIGH);
digitalWrite(RF_M_DRV2, LOW);
} else if(incomingByte == 'r') {
Serial.println(analogRead(PIN_POS));
}
}
if (My_Receiver.GetResults(&My_Decoder)) {
//Restart the receiver so it can be capturing another code
//while we are working on decoding this one.
......@@ -94,7 +128,6 @@ void loop() {
Serial.print("Unkwon: ");
Serial.println(My_Decoder.value);
}
//My_Decoder.DumpResults();
}
}
......
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