View Single Post
  #5   Spotlight this post!  
Unread 29-01-2004, 10:23
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,801
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: help! Am really stuck!!!!

Quote:
Originally Posted by pagemauck
Have been trying for a week to get digital input while in autonomous mode. After the Getdata line in void User_autonomous_Code we have

if (rc_dig_in06 == 0) pwm01=255: else pwm01=127;

We have the light sensor hooked up to digital input #6. It appears to be working and we have adjusted sensitivity on it. We have also swapped out the sensor. Simple lines like pwm01=255; work fine in our program. I have tried moving this line in all places in the program but it doesn't help.

My students want to write code to read wheel speed using this sensor, but I am frustrated I can't get input.

Any ideas would be very much appreciated!!!

There are a couple of things wrong with the line as you posted it. The value 255 is invalid and there should be no colon after "254". It really should be:

Code:
if (rc_dig_in06 == 0) 
  pwm01=254;
else 
  pwm01=127;

or if you really like to run things together:

if (rc_dig_in06 == 0) pwm01=254; else pwm01=127;
To help you debug it add:

printf("input 6 = %d\n", (int) rc_dig_in06 );

You can at least see and confirm the functioning of the light sensor.

If you'd like to send your code, PM me and I'll help you debug the problem further.

[edit]
Corrected my error (thanks Dav). I wasn't thinking straight this morning.
[/edit]
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 29-01-2004 at 11:47.