Hi
ganz einfache frage. ich habe 2 buttons. einer ist über android per httpurlconnection was auch alles einwandfrei funktioniert und der andere ist ein capacitive button.
#include <Bridge.h>
#include <BridgeClient.h>
char led_state[16];
const int buttonPin = 12;
const int digitalPinLicht = 2;
BridgeClient client;
void setup() {
pinMode(digitalPinLicht, OUTPUT);
pinMode(buttonPin, INPUT); //Button data
Bridge.begin();
}
void loop() {
bool btns = digitalRead(buttonPin);
Bridge.get("ledhigh", led_state, 1);
if(led_state[0] == '1' && btns == HIGH)
{
///NEED HELP
digitalWrite(digitalPinLicht,LOW);
Bridge.put("ledhigh",0);
Serial.println("X");
delay(150);
}
if (led_state[0] == '1' && btns == LOW)
{
digitalWrite(digitalPinLicht,HIGH);
Serial.println("2");
delay(150);
}
if (led_state[0] == '0' && btns == HIGH)
{
digitalWrite(digitalPinLicht,HIGH);
Bridge.put("ledhigh",1);
Serial.println("3");
delay(150);
}
if (led_state[0] == '0' && btns == LOW)
{
digitalWrite(digitalPinLicht,LOW);
Serial.println("4");
delay(150);
}
}
nun folgendes scenario:
handy → licht an
btn drücken → licht geht aus.
erneutes drücken vom btn licht geht nicht an.
habt ihr noch andere anregungen und vorschläge dann lasst es input regnen
danke euch schon mal im vorraus.