Regarding Software Serial


hi. want access hc-05 module using software serial library on arduino uno. doesn't work. hc-05 module okay working on '0' , '1' serial communication pins. software serial hv used '10' & '11' rx & tx respectively. uesd "myserial.listen()" enable rx pin '10'. not working.
personally, think there no need of "myserial.listen()" case 1 device connected using software serial. need work on basic example-turning on led using bluetooth , software serial.
i know 2 or more devices communicating using single arduino how software serial work , code.
i attaching code better understanding of problem.

include short programs in post people don't have download files

code original post

code: [select]
#include <softwareserial.h>

#define rx 10
#define tx 11
#define led 13

//char d;

softwareserial myserial(rx,tx);
void setup() {
  // put setup code here, run once:
      serial.begin(9600);

    myserial.begin(9600);

}

void loop() {
  // put main code here, run repeatedly:
    string c ="";
     myserial.listen();
     while(myserial.available()>0){
       char d =(char)myserial.read();
       c += d;
        serial.write(d);
       }
//    serial.println(c);
     if(c == "a")
     digitalwrite(led,high);
     else if( c == "b")
     digitalwrite(led,low);
}


...r


Arduino Forum > Using Arduino > Programming Questions > Regarding Software Serial


arduino

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'