GPIO Pin BTN LED naming conventions specific to ESP8266 #5634
Replies: 1 comment
-
Posted at 2017-01-31 by @allObjects ESP8266 is a bit resource strapped and thus not allowing for all Espruino modules and definitions... there is a ESP8266_BOARD.py file that provides the infos to the build, doc and mapping for coding. Posted at 2017-01-31 by Wilberforce The esp8266 is a chip, and various different modules are available that may on may not have the LED. There is a module called nodemcu that maps the PIN numbers on the nodemcu board to gpio numbers, so that might be useful for you. The Here is an example with a button and a led, and also reading a temperature sensor, so just remove that part of the code: http://forum.espruino.com/conversations/282721/#comment12822865 Posted at 2017-02-02 by Robin Thr 2017.02.02 Using the constant names located in ESP8266_BOARD.py link provided by @allObjects, and a snippet plucked from the example provided by @wilberforce, I was able to r/w a GPIO pin and button input on the specific board I have. Thank you both. Attempting to explore further using pinMode() produced yet another error:
The spec Expresive datasheet p.14 indicates the ability to configure internal pullup or pulldown. The Espruino Reference page also shows the attribute 'input_pullup' Even tried adding module var esp8266 = require('ESP8266'); without success. Is there another module I must add to allow the Pin class functionality to be usable on the ESP8266? Robin Posted at 2017-02-02 by @MaBecker Hi Robin,
or set input_pullup
Posted at 2017-02-02 by DrAzzy What on earth would you expect BTN to refer to? The ESP8266 module doesn't have a button on it! Posted at 2017-02-02 by Ollie Dev boards like NodeMCU and D1 Mini do. They don't respond as BTN but... Posted at 2017-02-03 by Robin Thr 2017.02.02 Good catch. I must have had a senior moment. That saved me a few hours of hair pulling of whats left. Thank you @MaBecker I knew I had seen the syntax on this site without the quotes, but I must admit I missed this from the Espruino Reference page
mind stuck in 'why doesn't this argument work now' mode and just didn't get back into gear for the basics. It should have dawned on me to create a variable from the literal to become compiler compliant. nasty accuracy checker. ;-)
Now with the syntax corrected, this error pops up for the 'input_pulldown' on the ESP8266
This only occurs on pulldown but pullup functions as expected. Since I haven't seen documentation detail on 'input_pulldown' for the ESP8266, may I AssUMe that the Espruino Reference documentation is for Espruino boards only; the compiler is accurate and that the ESP8266 module doesn't have this feature available? Posted at 2017-02-03 by Robin
Is that a polite way of calling me a D.A. ? I'm staring at my ESP8266 board with two buttons on it, and yes, I'm under the legal limit right now . . . . Posted at 2017-02-03 by @MaBecker Hi Robin,
Yes this causes an error because espressif do not allow this for regular pins. check http://bbs.espressif.com/viewtopic.php?f=5&t=481 Posted at 2017-02-03 by DrAzzy The modules that most people are using are The ESP-12 is commonly used in other development boards (like NodeMCU boards) that provide additional external components (USB serial on-board, buttons, level shifters, etc) - you must be using one of those. Posted at 2017-02-03 by Robin Fri 2017.02.03 Thank you @MaBecker That doc pretty much spells it out, doesn't it. I just wish I had the wealth of knowledge, right now, that those of you have, working with these modules. Still trying to run before I've learned to walk. It is of great help that there are those that keep up the support of we new arrivals. Thanks again. Posted at 2017-02-04 by @MaBecker Keep on going, your knowledge will grow day by day. Compared to other people posting on this forum I am still a beginner. As you are using a ESP board, feel free to donate for Gordons amazing product. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2017-01-30 by Robin
Mon 2017.01.30
Attempting to learn the BTN and LED naming conventions for the ESP8266
What worked on the Pico causes 'Uncaught ReferenceError' errors when deployed to the ESP8266
Works on the Pico
if( digitalRead(BTN) == 1 )
Uncaught ReferenceError: "BTN" is not defined
Ultimately trying to read and write data to a pin and toggle on and off, the onboard and offboard LED's on ESP8266
While this tutorial worked on Pico had the same reference error issue with the LED constants on ESP8266 https://www.espruino.com/Control+LED+with+Button
Uncaught ReferenceError: "LED1" is not defined
Looked over reference page: http://www.espruino.com/Reference#t_Pin
Looking over the ESP8266 tutorial, no references appear to be made here either
http://www.espruino.com/EspruinoESP8266
Tried searching the Espruino on ESP8266 forum and I attempted the links below, but with no results
http://forum.espruino.com/microcosms/925/
https://github.com/search?utf8=%E2%9C%93&q=espruino
https://github.com/espruino/Espruino/tree/master/libs
Can someone point me to a Espruino reference link that spells out the convention please.
Beta Was this translation helpful? Give feedback.
All reactions