Arduino Uno-esp8266 doesn't show anything on serial monitor


hello there, i'm new arduino programming. i'm trying connecting esp8266 arduino uno. , heartbeat sensor.
my question why there nothing on serial monitor. here part of code.

void setup()
{
  setupheartmonitor(hrmi_hr_alg);
 
  // setup serial connection
  serial.begin(9600);
 
  //esp8266
  ///////////////////////////////////////////////////////////////////////// 
  //serial.settimeout(5000); 
  dbgserial.begin(9600);   

  serial.println("esp8266 connect"); 
 
   
   boolean connected=false; 
   for(int i=0;i<10;i++) 
   { 
       if(connectwifi()) 
       { 
         connected = true; 
         break; 
       } 
   } 
     
   if (!connected){while(1);} 
   delay(5000); 
   
   dbgserial.println("at+cipmux=0"); 
 
 
}

i think @ least < serial.println("esp8266 connect");  > should printed. did not printed.

the full code here,
https://github.com/drinkingsheep/pj/blob/master/hrmi.ino


i tested connection between esp8266 , arduiono uno below code. , there no problem.

#include <softwareserial.h>

softwareserial esp8266(6, 7);

void setup() {
  // open serial communications , wait port open:
  serial.begin(9600);
  while (!serial) {
    ; // wait serial port connect. needed native usb port only
  }

  serial.println("started");

  // set data rate softwareserial port
  esp8266.begin(9600);
  esp8266.write("at\r\n");
}

void loop() {
  if (esp8266.available()) {
    serial.write(esp8266.read());
  }
  if (serial.available()) {
    esp8266.write(serial.read());
  }
}

how can solve problem?

sorry poor english.

it looks you're trying print hardware serial before it's ready.

to prevent happening, second sketch has before prints serial output

code: [select]
while (!serial) {
    ; // wait serial port connect. needed native usb port only
  }


i think if re-used idea in sketch you'd output expect.

good luck!


Arduino Forum > Using Arduino > Programming Questions > Arduino Uno-esp8266 doesn't show anything on serial monitor


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor