View Single Post
  #5   Spotlight this post!  
Unread 11-02-2007, 01:20
Stuart's Avatar
Stuart Stuart is offline
#include coffee.h
FRC #1745 (P51- Mustangs)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Dallas, TX
Posts: 414
Stuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond reputeStuart has a reputation beyond repute
Send a message via AIM to Stuart
Re: How do I program this sensor?

switch(count)
{
case 1:
//all your if count == 1 here
break;// never ever ever forget to put this . .ever
case 2:
//all your if count == 2 here
break; //EVER
case 3:
.
.
.
.
.
case 8:
//blah
break;
}

also for bidirectional I would have something like this before incrementing the count
if(pwm13 >= 127)
count++;
else
count--;


also when you stop the motor and "remap it" to the joy . .you wont see a stop. it will set pwm13 to 127 then set it to what ever the joy is at when it stopped in the next line. so youll have to figure a way to pause it for a sec(I would suggest using 2 digital buttons one for step up a notch and one for step down . .and some way of overriding)
__________________
Proud mentor of Team #1745 the P-51 Mustangs

If at first it doesn't work, use a hammer.
If that doesn't work, use a bigger hammer.