Ultrasonic Sensor not working?
Hello everyone,
I wonder if there is something wrong with my Otto or if i potentially made a mistaken during assembly. Here are the reproduction steps:
- Open editor: https://hprobots.com/otto-code/webcode/webcode.html (blocks)
- Load the program i attached (it basically is a forever loop that goes with if/else through the ultrasonic sensor values and changes color/sound based on it - maybe i got a logical error or I am using it incorrectly?)
- Execute the program
- Expected: When move my hand closer to Otto's ultrasonic sensor (the "eyes") I would expect based on my code that the colors change and the sound changes as well, the closer i get.Â
- Actual: It stays on the <= 5 cm shows, no matter how far away or close i move my hand, which makes me think I might have made a mistake during assembly 🤔 ?
Looking forward to whether you have any ideas, in the meantime i will double check the assembly of the Otto :) thanks!
It seems i am unable to attach am otto- file. I selected a file called ultrasonic_color.otto but it's not being uploaded. So I will post an image - it should convey the general idea of the program.
Ok so i confirmed that the sensor itself works - it correctly detects the distance with the sample project and prints it to the console - so the problem must somehow be in my code - that I should be able to figure out :) case closed.
Â
For future reference the following works - so the issue was indeed with my code. I really recommend the serial monitor print to debug behaviour - lesson learned :)Â
Hi @agentknopf welcome to the community good to see you here!
We coincidentally in the new update are working on a way to show where the error is in the monitor. With ultrasonic we are having this odd behavior that we are trying to see how to settle from the roots so you do not have to create a variable as you did.
Thanks!
- 16 Forums
- 60 Topics
- 295 Posts
- 2 Online
- 3,234 Members
