Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <RCSwitch.h>
- RCSwitch mySwitch = RCSwitch();
- int brochePotentiometre = 1;
- int valeurPotentiometre = 0;
- int valeurPotentiometreMemoire = 0;
- long temporisation;
- bool enCours = false;
- void setup() {
- Serial.begin(115200);
- // emetteur broche 10
- mySwitch.enableTransmit(10);
- temporisation = millis();
- }
- void loop() {
- valeurPotentiometre = map(analogRead (brochePotentiometre), 0, 1023, 100, 35);
- //if ((millis() - temporisation) > 150) {
- if (valeurPotentiometre != valeurPotentiometreMemoire) {
- enCours = true;
- valeurPotentiometreMemoire = valeurPotentiometre;
- //mySwitch.send((valeurPotentiometre + 3000), 16);
- temporisation = millis();
- } else {
- if (enCours == true) {
- mySwitch.send((valeurPotentiometre + 3000), 16);
- //temporisation = millis();
- enCours = false;
- } else {
- enCours = false;
- }
- }
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement