by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Nikolas Beutler
@biacz
@ongvanor what do you mean exactly?
just use as described here
ongvanor
@ongvanor
im using pin D0 to D4 in output for LEDS i want to use D5 to D8 as input pins is that possible?
Nikolas Beutler
@biacz
sure
ongvanor
@ongvanor
so i can say that pinMode(D4,INPUT); to declare as input?
Nikolas Beutler
@biacz
i always use the GPIO numbers
like pinMode(12, INPUT);
ongvanor
@ongvanor
ohhhh i see thanks :)
ongvanor
@ongvanor
is there libraries i should add? im getting confused its not working lol
Nikolas Beutler
@biacz
no
is this true that GPIO16 can only be used in read and write? other pins like D5 to D10 cant be used?
Martin Ayotte
@martinayotte
As the notice says, GPIO16 can't support interrupt. Also, it has a PullDown, but no PullUp. Other than that, it can be use as normal GPIO.
ongvanor
@ongvanor
how about D5 to D8 can i use it for input button? i've been coding for hours cant find a solution
ongvanor
@ongvanor
im having this error rst cause:2, boot mode:(3,6), can this be a not enough power, im powering up in VIN 5+ 2A power supply will that be enough or i should really have a 3.3v converter to power up the module
Nikolas Beutler
@biacz
thats fine
hmm when do you have the error exactly?
ongvanor
@ongvanor
blob
when the loop goes in that function
resetSsidandpwd is D0 and is set to input
Nikolas Beutler
@biacz
well you are resetting your ESP. so you would see the above rst cause message
ongvanor
@ongvanor
oh crap i missed that area thanks for noticing
it should be inside the if statement
Steve Nelson
@zenmanenergy
Am I looking at the wrong page... the filesystem docs don't have the file.write() method. https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md
Martin Ayotte
@martinayotte
@zenmanenergy , File class is derived from Stream, and Stream is derived from Print, and Print has the write() method.
Steve Nelson
@zenmanenergy
So, the file object itself does not have a write method?
Martin Ayotte
@martinayotte
No need to overwrite this method, simply use the derived one.
Steve Nelson
@zenmanenergy
ok. I think I understand. thanks
Martin Ayotte
@martinayotte
Welcome
ongvanor
@ongvanor
node mcu has really have small number of inputs is there a way i can use PWM as input with buttons that have different resistors that makes them unique in pressing?
Steve Nelson
@zenmanenergy
There are very inexpesive modules on ebay that will increase the number of GPIOs. I got some a few years ago, haven't played with them since, but if I recall, you connect the module to the esp through i2c, then there are libraries to read and write to the additional pins. I think the ones I used added 8 GPIOs
ongvanor
@ongvanor
can i have a sample? i might find one in here locally (hopefully)
Martin Ayotte
@martinayotte
PCF8574 or MCP23017
Steve Nelson
@zenmanenergy
Here's one from my purchase history PCF8574T
jesus martin is fast.
$1.30 from China
I didn't need to, but I'm pretty sure you can add a whole crapton of these to a single device by changing the dipswitches. I think you can add up to 64 GPIOs with these.
ongvanor
@ongvanor
never saw this kinds of module here locally errrr i need 4 GPIO
Steve Nelson
@zenmanenergy
The ESPhttpUpdate class only updates the bin file, correct? It doesn't overwrite the SPIFFS files. Is that right?
bobcroft
@bobcroft
@ongvanor, Hi I would scrap the idea of using a resistor ladder to determine which of 4 buttons is pressed, its not reliable. As Martin suggested use an I2C port expander. I use the PCF8574 with great success for both inputs and outputs. for example I use one to get the address of a particular module. I also use one a relay driver for eight relays. So I get 8 extra inputs and 8 extra outputs for just two ESP8266 I/O pins SDA/SCL. If you use different I2C addresses with PCF8574 modules then you can expand to 256 I/O. PCF8574 modules are readily available on Ebay.
I would also suggest the as you develop code to use the library examples, get them working then tweak them to suit your specific need. In that way you are starting from a solid base. Another suggestion is to go on line and look for Neil Kolban's book on the ESP8266. Its excellent!
Michael Miller
@Makuna
@ongvanor @bobcroft Not reliable? I have done this with at least one project and there are several prebuilt button boards that are analog (using resistor networks). I built a library to turn it into input events here GitHub/Makuna/AnalogKeypad.
The only thing you have to understand is that you can't press more than one button at a time AND that its not interrupt based so that when you code, using delays() will make it not work well; but any project of significance will avoid delays() already.
bobcroft
@bobcroft
@Makuna . Good points. I too have used analogue buttons, I was trying to use 10 buttons so probably a bit ambitious for me and I wasn't aware of your library at the time. I also found that if I accidentally caught two buttons I got erroneous readings. I agree about delays. Anyway ongvanor now has a few ideas to help him on his way
Michael Miller
@Makuna
Theorically, if the resistors are power of 2, then you should be able to read multiple buttons down, but due to limited analog (10bit) and general noise, this would at best equate to only 8 buttons (2 bits of error); and more likely around 5-6 buttons.
ongvanor
@ongvanor
@bobcroft and @Makuna thanks for the input guys. i just need 4 buttons and each buttons is unique, i wont be pressing multiple buttons,
@Makuna can i use that library in the esp-12e dev module?
ongvanor
@ongvanor
the A0 is pretty inconvenient for 1Vmax input
it would be better if it was 3.3v