wrmhl icon indicating copy to clipboard operation
wrmhl copied to clipboard

Null error after one successful sensorRead

Open dilanshah opened this issue 6 years ago • 8 comments

My system details: image

image

Serial monitor shows normal function: image

I closed arduino and serial monitor

Works for the first couple, but then null:

image The issue is on this line:

image

I'm preparing a biology experiment where the communication would be very useful. How do I remedy this? thanks so much! -Brian

dilanshah avatar Mar 21 '18 04:03 dilanshah

@bc

dilanshah avatar Mar 21 '18 04:03 dilanshah

I can prevent these issues by by restarting the computer. If the SerialMonitor is opened at any time, even after closing it there are permission errors in Unity. Why is this?

bc avatar Mar 21 '18 04:03 bc

I am also getting same kind of result like, I am uploading the code to Arduino. Then I run the unity file. It reads the thread perfectly and gives me data.

Then when I disconnect the arduino from Port and reconnect it, run the unity file , it throws this NULL value.

SHANTANUB009 avatar May 25 '18 14:05 SHANTANUB009

I am also getting this null value, with a simple program similar to the above.

This worked fine with one of my boards, and then after switching to a much faster Teensy 3,2 board it now returns Null only (with one Hello World getting in).

cptdustmite avatar Jul 02 '18 05:07 cptdustmite

I found out that I can get it almost working if I introduce a delay in my Arduino code at the end of the loop.

Tested with various combinations of Arduino delay and wrmhl readTimeout, the best combination is delay of 5 in Arduino and readTimeout of 25 in wrmhl. This returns all values properly except for the very first one which is Null.

cptdustmite avatar Jul 02 '18 06:07 cptdustmite

Thanks for the contribution, I will investigate the issue ! I close the issue for the moment but feel free to re-open any time !

maxim-perumal avatar Sep 10 '18 09:09 maxim-perumal

Same problem here :(

lordton avatar Sep 15 '19 19:09 lordton

Changing baudrate, timeouts of arduino and unity does change things a little. Sometimes you can get 3-4 successful reads before NULLs.

Also i have noticed that if you start Arduino IDE serial monitor, then close it, then play the Unity project, you get the first readings. If then you stop unity and play again, you get NULLs straight away. If you stop again, run Arduino IDE serial monitor, close it and then replay Unity project, then again you get the first readings.

I'm running a clone Arduino Nano on OsX High Sierra and Unity 2018.1.6f1 . I guess i should try another board or windows, but don't have them at the moment.

Please help 🙏

lordton avatar Sep 16 '19 10:09 lordton