Go Down

Topic: Virtual wire help (Read 377 times) previous topic - next topic

I am using sparkfuns transmitters and receivers and using the virtual wire library so my two arduinos can communicate. But I am having trouble with the code... How do you write something like "When you see this string-do this"? I have 14 commands I need to send ( 14 different things the receiving arduino will do when it gets one of the 14 messages from the sending arduino ). How would one go about doing this? As you have guessed I am pretty new to this whole thing and any help is greatly appreciated, but please try to keep the lingo to beginner levels.

Thanks in advance!

PaulS

Quote
How do you write something like "When you see this string-do this"?

The VirtualWire class has a receive event handler. In that handler, you read the whole message.

Then, use strcmp() to compare the message to known messages, and do something when a match occurs.

If the messages contain data, too, strtok() can be used to parse the message.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy