View unanswered posts | View active topics It is currently Mon Jun 25, 2018 11:50 am

Reply to topic  [ 3 posts ] 
Ultrasonic Sensor problem 
Author Message

Joined: Sun Jan 06, 2008 9:06 pm
Posts: 3
Post Ultrasonic Sensor problem
I'm having a problem getting an ultrasonic sensor working with the RobotC firmware.

Using code like the sonar examples I seemed to get random values around 994 to 1003 that showed no correlation with changes in distance to an object in front of the sensor.

I went to the View menu on the brick and selected the US(cm) option and all I get there are ??????. Happens with different cables and ports.

I put the Lego firmware back on the brick and tried the same thing. View US(cm) reports reasonable distance values.

I put the RobotC firmware on the brick again and the US sensor quits working.

I'm using RobotC 1.10 and firmware NXT0723.rfw.


Sun Jan 06, 2008 9:16 pm

Joined: Sun Jan 06, 2008 9:06 pm
Posts: 3
I finally resolved my problems with the Ultrasonic sensor and thought I'd reply to my original post with what I discovered. May be this will help someone in the future.

First, the View Ultrasonic tool on the NXT brick seems to be broken when the RobotC firmware is loaded. I originally thought this was related by my problem using the sensor, but that isn't the case. It seems to be a separate issue and sent me down the wrong path debugging my problem.

The solution came when I discovered the motor and sensor 'wizard' tool. I had based my application on snippets from the sample applications that I had typed in myself or copy/pasted from the samples. I removed my code and ran the wizard to configure it for the US sensor. It auto-generated some code and after that my program started working correctly when reading values from the US sensor. The code that was generated seems to be identical to the code I wrote by hand with the exception of text formatting and comments. I even did a copy/paste of the generated code into a separate program and that program failed to read from the sensor.

So, I still have no idea why my original code didn't work but at least I've made it past this problem and can start writing something useful.


Thu Jan 17, 2008 4:46 pm

Joined: Wed Mar 26, 2008 9:20 pm
Posts: 1
Location: Edinburgh, UK
Thank you, I was having exactly the same problem. Your post was very helpful.



Wed Mar 26, 2008 9:22 pm
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.