-->
Page 1 of 2

Code for GPIO ESP8266

PostPosted: Fri Mar 27, 2020 8:27 am
by tomcat22
Hi, I am a new member of this forum, and I am also a newbie in programming.
I use a WI-FI board ESP8266 12E, Arduino IDE with BLYNK libraries, Usb-serial converter with 340G driver.
I uploaded the BLYNK example, which works fine, but I have a problem configuring the GPIO on the sketch.
When I restart the app, the GPIO starts at a high level, in my project they have to start at a low level, can you help me write the part of the doors of the board?
This is BLYNK example is original with no added code:

**************************************************************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-librar ... ses/latest

Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.

Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Follow us: http://www.fb.com/blynkapp
http://twitter.com/blynk_app

Blynk library is licensed under MIT license
This example code is in public domain.

*************************************************************
This example runs directly on ESP8266 chip.

Note: This requires ESP8266 support package:
https://github.com/esp8266/Arduino

Please be sure to select the right ESP8266 module
in the Tools -> Board menu!

Change WiFi ssid, pass, and Blynk auth token to run :)
Feel free to apply it to any other example. It's simple!
*************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

void setup()
{
// Debug console
Serial.begin(9600);

Blynk.begin(auth, ssid, pass);
}

void loop()
{
Blynk.run();
}

Re: Code for GPIO ESP8266

PostPosted: Fri Mar 27, 2020 12:55 pm
by quackmore
at boot some of the gpio go high and some others go low
don't think you can do much with code
you will need some additional hardware to force the desired level at boot for the selected pin

or just select the pins with the behavior you need

I'm using a WEMOS D1 mini and this is the behavior I observed at boot

Code: Select all// D1 -> LOW                   
// D2 -> LOW                   
// D3 -> LOW  ?? to be verified
// D4 -> HIGH ?? to be verified
// D5 -> HIGH                   
// D6 -> HIGH                   
// D7 -> HIGH                   
// D8 -> LOW                   

/*
 * Digital I/O map for MODEMCU, WEMOS D1 mini
 *
 *      gpio      pin     mux
 * -----------------------
 * D1 GPIO5   pin24 GPIO5_U
 * D2 GPIO4   pin16 GPIO4_U
 * D3 GPIO0   pin15 GPIO0_U
 * D4 GPIO2   pin14 GPIO2_U
 * D5 GPIO14 pin9   MTMS_U
 * D6 GPIO12 pin10 MTDI_U
 * D7 GPIO13 pin12 MTCK_U
 * D8 GPIO15 pin13 MTDO_U
 */

Re: Code for GPIO ESP8266

PostPosted: Fri Mar 27, 2020 1:16 pm
by tomcat22
Thanks for the prompt reply, so in the project I have to take this situation into account, I thought you could write code art and put them all at LOW :)
About the ADC Analogic pin that accepts max 0-1v / 1023, what can I connect to measure a variable V = 0> 24V? which Hardware?
Bye

Re: Code for GPIO ESP8266

PostPosted: Fri Mar 27, 2020 9:46 pm
by quackmore
Can't help for the ADC, better open a new post...