To show you how to use digital inputs and digital outputs, we’ll build a simple project example with a pushbutton and an LED. ![]() Take a look at the ESP8266 GPIO Reference Guide to learn which GPIOs are more suitable to use as inputs. To read a digital input, like a button, you use the digitalRead() function, that accepts as argument, the GPIO (int number) you are referring to. ESP8266 NodeMCU Read Digital Inputsįirst, set the GPIO you want to read as INPUT, using the pinMode() function as follows: pinMode(GPIO, INPUT) ![]() Take a look at the ESP8266 GPIO Reference Guide to learn which GPIOs are more suitable to use as outputs. To control a digital output you just need to use the digitalWrite() function, that accepts as arguments, the GPIO (int number) you are referring to, and the state, either HIGH or LOW. Use the pinMode() function as follows: pinMode(GPIO, OUTPUT) ![]() Installing ESP8266 Board in Arduino IDE (Windows, Mac OS X, Linux)įirst you need set the GPIO you want to control as an OUTPUT.So, make sure you have the ESP8266 boards add-on installed before proceeding: We’ll program the ESP8266 using Arduino IDE.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |