while(Serial.available()<=0);
Why does this not work on the Z-Uno? It hangs and can't be accessed unless I plug it in while holding the service button. Is this because of the Z-Wave-part being processed? I remember reading something about that...
while(Serial.available()<=0);
Re: while(Serial.available()<=0);
Check our example like http://z-uno.z-wave.me/projects/control ... e-network/
You should use
while (Serial1.available()) {
You should use
while (Serial1.available()) {
Re: while(Serial.available()<=0);
If you want to wait until there is something, you should add a delay(10) inside. Delay still allows radio and Z-Wave part to execute
Re: while(Serial.available()<=0);
I'm sorry, I was using Serial1, i failed to copy from the right Sketch :/
So this is the code:
It's for a fingerprint reader and it wait until there is data send with the while loop... When the Z-Uno get to this partit hangs (the LED stop blinking). Can i implement it in any other way?
So this is the code:
Code: Select all
//Function:wait data packet send finish
unsigned char WaitFpData(void)
{
int i;
unsigned char rBuf_p = 0;
while(Serial1.available()<= 0);
for(i=200; i>0; i--)//wait response info
{
delay(20);
rBuf[rBuf_p++] = Serial1.read();
if(Serial1.available() == 0)
{
g_ucUartRxEnd = 1;
g_ucUartRxLen = rBuf_p;
break;
}
}
if(rBuf_p == 0) return 0x00;
else return 0x01;
}
It's for a fingerprint reader and it wait until there is data send with the while loop... When the Z-Uno get to this part
Code: Select all
while(Serial1.available()<= 0);
Re: while(Serial.available()<=0);
Use:
Code: Select all
while(Serial1.available()<= 0) delay(10);
Re: while(Serial.available()<=0);
I'm sorry for being so slow This worked well and I am now up and running my FPC1020 on the Z-Uno. I'm ironing out some other bugs and will later post my project.. Thanks a lot