Open
Description
Using digitalWrite(pin, 0b10) sets the pin high as expected unless it is preceded by a digitalWrite(pin, 0b100), in which case writing 0b10 actually sets the pin low. Subsequent writes (including reattempting to write 0b10) behave as expected.
Recreated in a new blank sketch, using an UNO Wifi R2 and Arduino IDE 2.3.6
#define PIN_LED 25 //Wifi R2 built-in LED is on pin 25
void setup() {
//digitalWrite weird behaviour test
pinMode(PIN_LED, OUTPUT);
delay(2000);
digitalWrite(PIN_LED, 0b100);
delay(1000);
digitalWrite(PIN_LED, 0b10); //LED Turns off here; removing the above write causes this write to behave as expected
delay(1000);
digitalWrite(PIN_LED, 0b1);
}
void loop() {
// put your main code here, to run repeatedly:
}
Metadata
Metadata
Assignees
Labels
No labels