0

ESP8266 ESP-12E CP2102 Module NodeMcu
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ESP8266 ESP-12E CP2102 Module NodeMcu

by Justinnnnnnnnnnnnnnnnnnn on Mon May 27, 2019 9:02 am

Good morning, I have problems with the connection, I am using an adafruit code to connect to the Adafruit IO, but there is no way.
I really do not know what is happening;
- If the fault is in the Wi-Fi connection (I have tried it in two different Wi-Fi networks).
- Or if you are in connection with my Adafruit IO account.
- Or if the problem is in the microcontroller, I have also tested it with two different microcontrollers.
Add that I use the IDE Arduino 1.8.5 and I have the Adafruit IO library Arduino by Adafruit version 2.0.6; Adafruit MQTT Library version 1.0.3 and the Adafruit PN532
Someone could help me??
I attach the script.
Thank you
Attachments
sketch_may27a.ino
(628 Bytes) Downloaded 59 times

Justinnnnnnnnnnnnnnnnnnn
 
Posts: 7
Joined: Mon May 27, 2019 8:05 am

Re: ESP8266 ESP-12E CP2102 Module NodeMcu

by Justinnnnnnnnnnnnnnnnnnn on Mon May 27, 2019 9:13 am

I attached a couple of screenshots if they help.
Last edited by brubell on Tue May 28, 2019 10:25 am, edited 1 time in total.
Reason: Brent - removed PDF file in attachments, please upload an image instead.

Justinnnnnnnnnnnnnnnnnnn
 
Posts: 7
Joined: Mon May 27, 2019 8:05 am

Re: ESP8266 ESP-12E CP2102 Module NodeMcu

by brubell on Tue May 28, 2019 10:24 am

hi, can you paste your code with [code][/code] tags and paste a PNG/JPEG image instead of a PDF for security reasons? Alternatively, paste the error message from the serial console as plaintext in your response surrounded by [quote][/quote] tags.

Thanks!

brubell
 
Posts: 531
Joined: Fri Jul 17, 2015 10:33 pm

Re: ESP8266 ESP-12E CP2102 Module NodeMcu

by Justinnnnnnnnnnnnnnnnnnn on Tue May 28, 2019 6:38 pm

Hello friend, I appreciate you answering.

It does not give me any error in the serial console, and it turns out that I have been able to connect to the Wi-Fi network of my institute, and see the data through the adafruit dashboard, but not in my house I have no way of achieving it.
I thought it was a hardware issue, but I've seen no.
Now I am thinking that it could be because of my Wi-Fi network, because of the configuration issue or something similar that does not let you establish the connection with the microcontroller.
I can not connect ...


Code: Select all | TOGGLE FULL SIZE
#include <Arduino.h>
#include "adafruit.h"//permite al programa de acceder que estan en la pestaña Adafruit.h, ahora podemos utilizar las funciones de otra pestaña
#define SENSOR D8

void setup() {
    pinMode(SENSOR, INPUT);
    pinMode(LED_BUILTIN, OUTPUT);//led builtin es el led de la placa
    Serial.begin(9600);

    //hay que llamar a la funcion despues de serial
    connectToAdafruitIO();
   
    Serial.println("Connexion activa");
}

void loop() {
    int movimiento = digitalRead(SENSOR);
    if (movimiento == LOW) Serial.println("Detectando");
    else Serial.println("No detectando");
    sendToAdafruitIO(movimiento);
   
    delay(2500);
}


Code: Select all | TOGGLE FULL SIZE
// ESP826 board definition needs to be version 2.4.2 if using Arduino IDE
// or version @1.8.0 if using PlatformIO IDE
// Needs libraries: Adafruit IO, Adafruit MQTT, ArduinoHTTPClient
#include <AdafruitIO_WiFi.h>
#include <AdafruitIO.h>
#define WIFI_SSID "MOVISTAR_26E2"  //nombre de la red #define WIFI_SSID "b&b_gtw"
#define WIFI_PASS  "*******" //#define WIFI_PASS " bits..bits.."
#define AIO_USER "Justinnnnnnnnnnnnnnnnnnn"//usuario de adafruit
#define AIO_KEY "*********" //contraseña de adafruit en  "View AIO Key"#define AIO_KEY "dd77d8e28d1e438997e4cd7eb3be5886"


/**/
AdafruitIO_WiFi io(AIO_USER, AIO_KEY, WIFI_SSID, WIFI_PASS); //creamos objetos con la funciony le pasamos los parametros
AdafruitIO_Feed *feed = io.feed("movimiento");                 //le tememos que poner el mismo nombre que le hemos puesto en adafruit, es un feed, una cola de mensajes, siempre la pondremos el minusculas!!
AdafruitIO_Feed *pulsador = io.feed("pulsador"); //nombre del feed en adafruid

//creamos funcion para el pulsador
 void funcionPulsador(AdafruitIO_Data* paqueteDatosDeAdafruit)
 {//esta funcion la llama adafruit
     
  //para encender el led de la placa
  digitalWrite(LED_BUILTIN,paqueteDatosDeAdafruit-> toPinLevel());    //Te dice donde esta el led en la placa, d1,d2 o lo que sea
  Serial.println(paqueteDatosDeAdafruit ->value());
 
}


void connectToAdafruitIO() {//funcion que se conecta a adafruit, cuando se conecte sale de la funcion
  io.connect();
  while(io.status() < AIO_CONNECTED) {
    Serial.println("Connecting to Adafruit IO...");
    delay(500);
    }
  pulsador->onMessage(funcionPulsador); //pulsador es el Feed , recibe como parametro un nombre de otra funcion
 
}
//funcion que envia datos, la llamamos en cada ....
void sendToAdafruitIO(int value) {
  io.run();//funcion run, de mantenimiento de la conexion
  feed->save(value);
}

Justinnnnnnnnnnnnnnnnnnn
 
Posts: 7
Joined: Mon May 27, 2019 8:05 am

Re: ESP8266 ESP-12E CP2102 Module NodeMcu

by brubell on Wed May 29, 2019 9:57 am

Could you try setting your serial monitor to 9600 baud and adding a Serial.println("Connecting to IO..."); line before your call to connectToAdafruit();?

brubell
 
Posts: 531
Joined: Fri Jul 17, 2015 10:33 pm

Re: ESP8266 ESP-12E CP2102 Module NodeMcu

by Justinnnnnnnnnnnnnnnnnnn on Wed May 29, 2019 11:36 am

I have done what you have told me and I do not get anything more than the message that came to me before, the happy one:
  "Connecting to Adafruit IO ...
Connecting to Adafruit IO ...
Connecting to Adafruit IO ...
Connecting to Adafruit IO ...
Connecting to Adafruit IO ...
Connecting to Adafruit IO ...
Connecting to Adafruit IO ... "
It's infinite.
I can not get out of the loop either ... I do not know what to do.
Thank you

Justinnnnnnnnnnnnnnnnnnn
 
Posts: 7
Joined: Mon May 27, 2019 8:05 am

Re: ESP8266 ESP-12E CP2102 Module NodeMcu

by Justinnnnnnnnnnnnnnnnnnn on Thu May 30, 2019 8:35 am

Hi, I've tried the example of the Arduino id "wifi access point" and it detects my wifi network, but I still can not connect ...

Justinnnnnnnnnnnnnnnnnnn
 
Posts: 7
Joined: Mon May 27, 2019 8:05 am

Re: ESP8266 ESP-12E CP2102 Module NodeMcu

by brubell on Thu May 30, 2019 9:53 am

Justinnnnnnnnnnnnnnnnnnn wrote:Hi, I've tried the example of the Arduino id "wifi access point" and it detects my wifi network, but I still can not connect ...

Are your Adafruit IO key and username correct in the sketch?

brubell
 
Posts: 531
Joined: Fri Jul 17, 2015 10:33 pm

Re: ESP8266 ESP-12E CP2102 Module NodeMcu

by Justinnnnnnnnnnnnnnnnnnn on Thu May 30, 2019 11:49 am

If the password is correct...
I don't understand anything...

Justinnnnnnnnnnnnnnnnnnn
 
Posts: 7
Joined: Mon May 27, 2019 8:05 am

Please be positive and constructive with your questions and comments.