Skip to content
This repository has been archived by the owner on Aug 21, 2021. It is now read-only.

Null error after one successful sensorRead #8

Open
dilanshah opened this issue Mar 21, 2018 · 8 comments
Open

Null error after one successful sensorRead #8

dilanshah opened this issue Mar 21, 2018 · 8 comments

Comments

@dilanshah
Copy link

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
Copy link
Author

@bc

@bc
Copy link

bc commented Mar 21, 2018

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?

@SHANTANUB009
Copy link

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.

@cptdustmite
Copy link

cptdustmite commented Jul 2, 2018

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
Copy link

cptdustmite commented Jul 2, 2018

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.

@maxim-perumal
Copy link
Member

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

@lordton
Copy link

lordton commented Sep 15, 2019

Same problem here :(

@lordton
Copy link

lordton commented Sep 16, 2019

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 🙏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants