Hi, I´m using a global variable i that can not be changed in the main program
Here is the code:
include "mbed.h"
Serial device(p9, p10); // tx, rx
DigitalOut led3(LED3);
unsigned char buf[1000];
unsigned int i=1;
void rec() {
buf[i]=device.getc();
i++ ;
}
int main()
{
device.attach(&rec);
device.baud(19200);
while(1)
{
device.printf("AT\r");
if(buf[i-1]=='0'&&buf[i]==0xD)
{led3=1;
i==1;
}
wait(6);
}
}
When I compile it says that Expression as no effect on main function( i==1; )
Can anyone help me so that I can use the variable i in the main function
Tanks
SOLVED!
i=0 not i==0 my mistake
Remove this topic please
Tanks
Hi, I´m using a global variable i that can not be changed in the main program
Here is the code:
When I compile it says that Expression as no effect on main function( i==1; )
Can anyone help me so that I can use the variable i in the main function
Tanks
SOLVED!
i=0 not i==0 my mistake
Remove this topic please
Tanks