first commit

This commit is contained in:
Jérôme Delacotte
2025-03-06 11:15:32 +01:00
commit 7b30d6e298
5276 changed files with 2108927 additions and 0 deletions

103
Blink/Blink.ino Executable file
View File

@@ -0,0 +1,103 @@
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 11. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://arduino.cc
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
*/
#include <RCSwitch.h>
boolean started = false;
int id = 0;
RCSwitch mySwitch = RCSwitch();
// Cas
// 12 = Courant général 0 éteint 1 allumé
// 11 = Mode radiateur 0 hors gel 1 confort
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 11 as an output.
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();
if (value == 0) {
Serial.print("Unknown encoding");
} else {
long data = mySwitch.getReceivedValue();
//Serial.print("Received ");
//Serial.print( data );
// Serial.print(" / ");
// Serial.print( mySwitch.getReceivedBitlength() );
// Serial.print("bit ");
// Serial.print("Protocol: ");
// Serial.println( mySwitch.getReceivedProtocol() );
//Serial.println("");
//delay(1000); // wait for a second
if (data == 111269) {
started = true;
// id = 0;
//Serial.println("started");
} else if (data == 962111) {
started = false;
id = 0;
//Serial.println("Arret");
} else if (data == 1969 || data == 2069 || data == 2169 || data == 2269) {
//Serial.print("id=");
//Serial.println(data);
// if (id == 0) {
id = data;
// } else {
// started = false;
// id = 0;
// }
} else {
if (started && id == 1969) {
Serial.print("Demarré ");
Serial.print("id=");
Serial.print(id);
Serial.print(" data=");
Serial.println(data);
//
if (data >= 1800) {
digitalWrite(11, HIGH);
digitalWrite(12, HIGH);
Serial.println("HIGH");
// delay(2000);
} else if (data > 1200) {
digitalWrite(11, LOW);
digitalWrite(12, LOW);
Serial.println("LOW");
//delay(2000);
}
}
}
}
mySwitch.resetAvailable();
}
}