Go Down

Topic: digitalWrite HIGH & LOW inverted (SOLVED) (Read 3980 times) previous topic - next topic

Mutabor

May 11, 2016, 11:19 am Last Edit: May 12, 2016, 10:16 am by Mutabor
Hello!

I bought the following board:
http://www.aliexpress.com/item/Free-shipping-NodeMCU-development-board-for-ESP-12E-from-ESP8266-esp-12E-Lua-IoT-programable-wifi/32583355412.html




I use the Arduino IDE, and everything works pretty much fine. I only have one problem:
If i test it for the blink sketch it reads HIGH as LOW and LOW as HIGH.

Example:
Code: [Select]

void setup() {
// initialize digital pin 16 as an output.
pinMode(16, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(16, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(16, LOW); // turn the LED off by making the voltage LOW
delay(100); // wait for 1/10 second
}


This should do (as far as i know) that the LED is on for 1 second and then have a short pause of 1/10 second.
But what the board is really making is the opposite. The LED is off for 1 second following a short blink 1/10 second and so on...
Am I insane or is this plain inverted?

I'm on a mac with Arduino IDE 1.6.8
I use the following bridge drivers:
https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx

Thank you for answers!

graynomad

Do you have a schematic? Maybe the LED is connected to VCC and not GND.
Rob Gray aka the GRAYnomad www.robgray.com

Riva

If the NodeMCU is using the same schematic as the below then yes the LED is inverted and will be on when pin is low and off when pin is high.

Don't PM me for help as I will ignore it.

Mutabor

Thank you so much! It works!

I was so excited over the new board I only tested the onboard LED.
The fact that it worked exactly inverted confused me a lot, I thought it is a hardware problem.

I really appreciate your help!

GiovanniBernal

I got the same problem, so just to know, In ES8266 when you rite LOW(at least in the built in led) it goes on Right?

Go Up