Code help
hi: i´m writing first code arduino. in project need receive vb program in pc data configure 1 int variable. i´ll using after in counter. data preceded char ('w') , need separate char rest.ex: 'w100'-> need separate 'w' char int 100 because variable setting must asume value.
i couldn´t find example in libraries,forum or site. can me?
thanks lot
i couldn´t find example in libraries,forum or site. can me?
thanks lot
to value pc want use serial interface, take @ 1 of example programs (most of ones under communications use serial) how use it. you need set vb program use serial interface on computer.
for character manipulation can compare character received waiting for, i.e.:
i think should work, though want error checking etc.
i haven't done many of these programs myself i'm not sure if next serial character have arrived time while loop checks whether serial.available() true. if not it's little more complicated, not very.
hope helps.
for character manipulation can compare character received waiting for, i.e.:
code: [select]
const int max_size = 5; //max number of digits in number
char num[max_size];
loop()
{
if(serial.available() && serial.read() == 'w') //wait w
{
int = 0;
while(serial.available())
{
num[i] = serial.read();
++i;
}
variable = atoi(num); //insert variable here
}
}i think should work, though want error checking etc.
i haven't done many of these programs myself i'm not sure if next serial character have arrived time while loop checks whether serial.available() true. if not it's little more complicated, not very.
hope helps.

Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Code help
arduino
Comments
Post a Comment