Community.

Your question might be already answered in the FAQ page

?

Ultrasonic Sensor n...
 
Notifications
Clear all

Ultrasonic Sensor not working?

5 Posts
3 Users
2 Reactions
84 Views
AgentKnopf
(@agentknopf)
Active Member
Joined: 5 months ago
Posts: 10
Topic starter  

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:

  1. Open editor: https://hprobots.com/otto-code/webcode/webcode.html (blocks)
  2. 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?)
  3. Execute the program
  4. 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. 
  5. 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!


   
Camilo reacted
Quote
Topic Tags
AgentKnopf
(@agentknopf)
Active Member
Joined: 5 months ago
Posts: 10
Topic starter  

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.


   
Camilo reacted
ReplyQuote
AgentKnopf
(@agentknopf)
Active Member
Joined: 5 months ago
Posts: 10
Topic starter  

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.

 


   
ReplyQuote
AgentKnopf
(@agentknopf)
Active Member
Joined: 5 months ago
Posts: 10
Topic starter  

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 :) 


   
ReplyQuote
Camilo
(@cparrapa)
Developer Admin
Joined: 9 months ago
Posts: 33
 

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!


   
ReplyQuote
Scroll to Top
Thank you for your interest in our robot Otto.
Let us inform you that the Otto Starter Kit will be ready for purchase at the end of January 2024.

If you would like to pre-order Otto Starter kit, feel free to contact us at email address moravia@moravia-consulting.com.
This will be available with the release of this product.