View unanswered posts | View active topics It is currently Sat Oct 25, 2014 8:24 am






Reply to topic  [ 4 posts ] 
[Help] My sensors don't work 
Author Message
Rookie

Joined: Sat Dec 06, 2008 6:34 am
Posts: 2
Post [Help] My sensors don't work
Solved
It was something with Moter & Sensor Setup, the problem is solved now :)



Hey all,

I'm new here. Yesterday I downloaded the robotc 31 day trial for my lego NXT.

The problem is that my sensors don't work. When I go on my NXT to 'view', the sensors don't work, ultrasonic is stuck at 253 and the other sensors are stuck at 0.

But... When I go to 'try me' they work fine.

Also the sensors don't work in a program:
Code:
task main ()
{
   while(SensorValue[S1] == 0) //S1 is the touch sensor
   {
      motor[motorA] = -75;
      motor[motorC] = -75;
   }
}


The robot doesn't do anything when I run this program.

Please help me.

Pepijn


Sat Dec 06, 2008 6:48 am
Profile
Rookie

Joined: Sat Jan 03, 2009 5:05 pm
Posts: 1
Post Re: [Help] My sensors don't work
I'm having the exact same problem. Trying to use the Ultrasonic(SONAR) sensor and its not reading any values. I reverted to the original firmware from LEGO and it worked fine in the demo. I've re-downloaded the RobotC firmware and I'm getting no readings or very intermittent readings. The motors are working fine. Help!


Sat Jan 03, 2009 5:08 pm
Profile
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: [Help] My sensors don't work
hi,
what if the sensor value is unequal to 0 from the beginning?
the program will never enter the while loop...
is this what you intended?

if not, maybe try this:

Code:
task main ()
{
  while (true)
  { 
    if (SensorValue[S1] == 0) //S1 is the touch sensor
    {
        motor[motorA] = -75;
        motor[motorC] = -75;
    }
    else
    {
       // if !=0 maybe do the following or anything else
        motor[motorA] = 0;
        motor[motorC] = 0;
    }
  }
}

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sat Jan 03, 2009 6:36 pm
Profile
Rookie

Joined: Sat Jan 31, 2009 9:35 am
Posts: 1
Post Re: [Help] My sensors don't work
gspence wrote:
I'm having the exact same problem. Trying to use the Ultrasonic(SONAR) sensor and its not reading any values. I reverted to the original firmware from LEGO and it worked fine in the demo. I've re-downloaded the RobotC firmware and I'm getting no readings or very intermittent readings. The motors are working fine. Help!


I had exactly the same problem. There is definitely something glitchy about the NXT ultrasonic sensor and RobotC. It's like RobotC forgets what sort of sensor it is. I managed to get around the problem by explicitly redefining the sensor type in an initialization function like this:

void Initialize()
{
SensorType[S4] = sensorSONAR;
}

Then I check the raw values of the sensor with SensorRaw[S4]

Again, it all works fine on the standard lego firmware.


Sat Jan 31, 2009 9:49 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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:  
cron



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