AWOL:
it means the code sometimes will fail to execute ? Am I correct ?
During development, code will always sometimes fail to execute as we expect it to.
But, no, you are not correct. "Blocking" means the code will loop waiting until a message is received. This may or may not be a problem for you.The great thing about the Arduino is that you can try things, and if they don't work, try something different.
The frequency of your questions leads me to suspect you're not trying the things you're asking about.
#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
Serial.begin(9600); // Debugging only
Serial.println("setup");
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver PLL running
pinMode(13, OUTPUT);
}
void loop()
{
uint8_t count;
if(count==true)
{
count = false;
}
count = vw_wait_rx_max(2000);// Non-blocking
if (true)
{
digitalWrite(13, HIGH); // Flash a light to show received good message
delay(500);// Message with a good checksum received, dump it.
digitalWrite(13, LOW);
delay(500);
}
else if(false)
{
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13,LOW);
delay(100);
}
}
I write this code..I want it to be like when it does not receive message for 2s, then it will return false. If it receive message, then return true. Then it will only blink once then the whole system become false again. So what moddification I need to do ?
Thanks