Serial port Tx and RX


dear forum,
i ask because have lot of problem serial trasmission on arduino board uno.

i created simple sketch

code: [select]
void setup() {
  // put setup code here, run once:
  serial.begin(9600, serial_8n1);
  valore=0;
}

void loop() {
  // put main code here, run repeatedly:
  string tmp = "!r1#" + string(valore) + "\r";
  serial.print(tmp);
  if (serial.available() > 0)
  {
    digitalwrite(led2,low);
    received = serial.readstring();
    serial.print(received);
  }
  delay (1000);
  valore++;

}


if tried execute sketch using arduino connects laptop there isn't problems. on serial monitor see strings.

when disconnect usb cable, connect battery (9v). connect serial cable rx/tx pin (0 , 1) , gnd. when try mesaure volts on tx don't see anything, , led tx doens't blink.

have idea?

thanks much

i connect serial cable rx/tx pin (0 , 1) , gnd.
you have not told connect them to. post diagram showing connections.

also, need oscilloscope see serial data signals.

and small pp3 style 9v battery not suitable cannot provide current. may work arduino short time when battery new.

...r


Arduino Forum > Using Arduino > Programming Questions > Serial port Tx and RX


arduino

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???