Hallo zusammen,
habe es jetzt soweit, dass er sie separat sendet.
Allerdings, wenn ich jetzt den Button 2 drücke, sendet er den code für Button 2 immer weiter...Bei Button 1 geht es ohne Probleme!
Code:
/*
Example for different sending methods
https://github.com/sui77/rc-switch/
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
int ledPin = 5; // choose the pin for the LED
int inPin1 = 15; // choose the input pin (for a pushbutton)
int inPin2 = 13;
int status_1 = 0; // variable for reading the pin status
int status_2 = 0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inPin1, INPUT); // declare pushbutton as input
pinMode(inPin2, INPUT); //declare pushbutton 2 as input
mySwitch.enableTransmit(0);
// Optional set protocol (default is 1, will work for most outlets)
mySwitch.setProtocol(1);
// Optional set pulse length.
mySwitch.setPulseLength(759);
}
void loop(){
status_1 = digitalRead(inPin1); // read input value
if (status_1 == HIGH) { // check if the input is HIGH (button released)
digitalWrite(ledPin, HIGH); // turn LED ON
/* Same switch as above, but using binary code */
/*mySwitch.send("010010010100000101000001");*/
Serial.println("Signal 1 wurde gesendet");
delay(1000);
digitalWrite(ledPin, LOW);
} else {
status_2 = digitalRead(inPin2); // read input value
if (status_2 == HIGH) { // check if the input is HIGH (button released)
digitalWrite(ledPin, HIGH); // turn LED ON
/* Same switch as above, but using binary code */
/*mySwitch.send("010010010100000101000001");*/
Serial.println("Signal 2 wurde gesendet");
delay(1000);
digitalWrite(ledPin, LOW);
}
}
}
Vielen Dank.
Lesezeichen