porblems with softserial not reading



i'm using arduino uno project, writing , reading device uart.

i've found softserial example sand working through those, can write enough form ardunio on soft serial (i can see thsi on pc) can not detect when writing it. i've got code below i've put togtehr form examples in ide.

to debug i've added piece of code toggle pin 13 led within portone.available() > 0 statement.

my setup arduino softserial port connected ftdi cable pc, running teraterm. can see "hello world" apprearing ok, know that's good.

i've put scope of arduino pin 8 , can see line toggling when send character through teraterm. know signal getting arduino rx pin.

to debug code i've added toggle pin 13 led within portone.available() > 0 statement, led doesn't toggle , i've scope dteh line , it's low (my default).

any advice greatfully received.


code: [select]

#include <softwareserial.h>
// software serial #1: tx = digital pin 10, rx = digital pin 11
softwareserial portone(8,9);
const int ledpin =  13;

void setup()
{
 // open serial communications , wait port open:
  pinmode(ledpin, output); 
  digitalwrite (ledpin, low);
  serial.begin(9600);
  while (!serial)
  portone.begin(9600);
}

void loop()
{
  portone.print("hello world :)"); // send something
  portone.end(); // end communication on first software

  portone.listen();
  serial.println("data port one:");
  // while there data coming in, read it
  // , send hardware serial port:
  while (portone.available() > 0)
    {
    digitalwrite(ledpin, high); 
    char inbyte = portone.read();
    serial.write(inbyte);
    delay(10);
    digitalwrite(ledpin, low);
  }
  delay(1000);
}

code: [select]
// software serial #1: tx = digital pin 10, rx = digital pin 11
softwareserial portone(8,9);

your code doesn't match comment. if going have useless comments, must make code match them.

code: [select]
  while (!serial)
  portone.begin(9600);

that not want do. waiting serial read necessary on leonardo , micro. if don't have either of those, rid of while statement (and missing body).



Arduino Forum > Using Arduino > Programming Questions > porblems with softserial not reading


arduino

Comments