When I run this program, the brain automatically exits out of the program when. I raise the tray. My hypothesis is that eventually, the brain is trying to move the motor at i percent speed, and it just nopes out of there
Hi Railgunawesome.
Accidentally calculating i should throw a value error, not crash the interpreter, as seen below:
Could you please give us a link to your project?
Sorry about this, but how do I share a project link?
Also, this is just what I suspect, there may be another issue I didnt notice. The code has since been updated to not make the program exit.
Thanks!
Copy the URL from the address bar to a post here. Make sure you’ve set the project to Public through the Options gear at the top right.
https://www.robotmesh.com/studio/5e094d29fcec5726fee9a94f
Here it is.
Thank you for checking it out!
You did the first step. You still need to set the project to public.
Oh yes, sorry.
When. I clicked on the gear, it gives me 3 public settings. Which one should I click?
If you want us to be able to see the code, I’d go with the one that says “including code”.
https://www.robotmesh.com/studio/5e094d29fcec5726fee9a94f
Here it is, I updated the permissions.
It’s possible you’re hitting a race condition between checking the condition of the if
and setting the tilter motor to move. Try storing the potentially unsafe value (tilter motor encoder + 700) in a variable. That way you can check against the value of the variable and have a guarantee that it will be the same value you later do math with.