I'm having trouble understading what I'm doing wrong here. I'm just doing some simple experiments with an 8266 project and am struggling with what is happening.
In the attached sketch I have 2 push buttons connecting 3v to D7(GPIO13) and D8(GPIO15) with both tied low with 4k7 resitors. Pressing button on D7 should turn on output D6(GPIO12) and Button D8 should turn it off again. It doesn't work, so I added the serial.prinlnt lines to debug. When the program runs the buttons do nothing and the serial output reports both GPIO15 and GPIO13 High all the time. Any ideas? Many thanks
int output12 = 12;
int input13 = 13;
int input15 = 15;
void setup() {
Serial.begin(115200);
pinMode(13, INPUT);
pinMode(15, INPUT);
pinMode(12, OUTPUT);
digitalWrite(output12, LOW);
}
void loop() {
if (input13 = 1) digitalWrite(output12, HIGH);
if (input15 = 1) digitalWrite(output12, LOW);
if (input13 = 1) Serial.println("Input 13 = High");
if (input15 = 1) Serial.println("Input 15 = High");
}