Another newbiw question here.
I am getting a string in through the serial port. I know its working, because I can getcchar and then putchar and it prints out on the terminal.
What I want to do is store the incoming string in an array so I can then sscanf it, and based on the result, take some action (turning relays on and off, LED's etc). here is the snippet (ch and remcom are declared at the top of the file thus: remcom[20], ch;
void serialstream(void) {
int r=0;
myled!=myled;
while ((ch=getchar()) !='\n'){
//pc.putc(remote.getc());
remcom[r]= ch;//(remote.getc()); /* get the char and send to the terminal */
r++;}
//pc.putc(remote.getc());
//myled!=myled;
}
This is not working - what am I doing wrong? Thanks
Another newbiw question here.
I am getting a string in through the serial port. I know its working, because I can getcchar and then putchar and it prints out on the terminal.
What I want to do is store the incoming string in an array so I can then sscanf it, and based on the result, take some action (turning relays on and off, LED's etc). here is the snippet (ch and remcom are declared at the top of the file thus: remcom[20], ch;
void serialstream(void) {
int r=0;
myled!=myled;
while ((ch=getchar()) !='\n'){
//pc.putc(remote.getc());
remcom[r]= ch;//(remote.getc()); /* get the char and send to the terminal */
r++;}
//pc.putc(remote.getc());
//myled!=myled;
}
This is not working - what am I doing wrong? Thanks