Go to Post Coming from one of the biggest mecanum fanboys in FIRST- have fun, drive fast, and forget the haters. - Brandon Zalinsky [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 18-02-2008, 08:37
rjn rjn is offline
Registered User
no team
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Why is this required
Posts: 15
rjn is an unknown quantity at this point
Please help with our IR code, we are so confused

This is our code for our hybrid, and we honestly have no idea what is wrong, it constantly blasts forward, even after a new button is hit

Code:
void Autonomous(void)
{
int move, othermove;

//printf("Time=%lu", Get_Time( ));

if ((rc_dig_in01 + rc_dig_in02 + rc_dig_in03 + rc_dig_in04) > 1)
{
rc_dig_in01 = rc_dig_in02 = rc_dig_in03 = rc_dig_in04 = 0;
}

othermove = move;
if (rc_dig_in01 == 1) {
move = 1;
}
else if (rc_dig_in02 == 1) {
move = 2;
}
else if (rc_dig_in03 == 1) {
move = 3;
}
else if (rc_dig_in04 == 1) {
move = 4;
}
else {
move = othermove;
}

printf("Move: %d In01: %d, In02: %d, In03: %d, In04: %d \r \n", move, rc_dig_in01, rc_dig_in02, rc_dig_in03, rc_dig_in04);
if (move == 0) 
{
pwm01 = 127;
pwm02 = 127;
pwm03 = 127;
pwm04 = 127;
}
else if (move == 1) {
pwm01 = 187;
pwm02 = 67;
pwm03 = 187;
pwm04 = 67;
}
else if (move == 2) {
pwm01 = 187;
pwm02 = 187;
pwm03 = 67;
pwm04 = 67;
}
else if (move == 3) {
pwm01 = 67;
pwm02 = 187;
pwm03 = 67;
pwm04 = 187;
}
else if (move == 4) {
pwm01 = 67;
pwm02 = 67;
pwm03 = 187;
pwm04 = 187;
}
else {
pwm01 = 127;
pwm02 = 127;
pwm03 = 127;
pwm04 = 127;
}
}
Any help would be very appreciated.

Last edited by rjn : 18-02-2008 at 08:44.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with our default code coolguybigt Programming 14 19-02-2007 10:17
What are with the Ls in Kevin's code??!!! HELP!!! RbtGal1351 Programming 2 18-02-2005 16:57
What is wrong with this code???? It won't Compile and I don't know why? Please Help CrashZero Programming 23 26-03-2004 09:44
Little help Please (with dead reconing code) Xufer Programming 17 22-02-2004 20:12
hey need some help with writing a code please help me here magical hands Programming 9 01-01-2004 21:46


All times are GMT -5. The time now is 11:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi