Go Down

Topic: VirtualWire (Read 3 times) previous topic - next topic

Vincent19

So, if I want to send a number 2, then how do I wrote it in array of 8 bits ??? Thanks

PaulS

Quote
So, if I want to send a number 2, then how do I wrote it in array of 8 bits ??? Thanks

Code: [Select]
uint8_t msg[1] = 2;
vw_send(msg, 1);

Vincent19

So from this can I say uint8_t is like a data type ?

For example int variable, so uint8_t variable ?

Thanks

Vincent19

#28
Jan 22, 2013, 03:13 am Last Edit: Jan 22, 2013, 08:55 am by Vincent19 Reason: 1

Quote
So, if I want to send a number 2, then how do I wrote it in array of 8 bits ??? Thanks

Code: [Select]
uint8_t msg[1] = 2;
vw_send(msg, 1);



So how about the receiving part ?
Code: [Select]
void loop()
{
   uint8_t buf[VW_MAX_MESSAGE_LEN];
   uint8_t buflen = VW_MAX_MESSAGE_LEN;

 [b]  if (vw_get_message(buf, &buflen)) // Non-blocking[/b]
   {
int i;

       digitalWrite(13, true); // Flash a light to show received good message
// Message with a good checksum received, dump it.
Serial.print("Got: ");

for (i = 0; i < buflen; i++)
{
   Serial.print((char)buf[i]);
   Serial.print(" ");
}
Serial.println("");
       digitalWrite(13, false);
   }
}

What does it means ?

AWOL

Quote
What does it means ?
As you posted it, it means nothing, which is why you should post your code between code tags [code] [/code]
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up