Go to Post This is Chief Delphi. We're all crazy here. - Whippet [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 11-01-2008, 16:40
taggartbg taggartbg is offline
Registered User
FRC #1712 (Dawgma)
Team Role: Electrical
 
Join Date: May 2005
Rookie Year: 2006
Location: Lower Merion, PA
Posts: 38
taggartbg will become famous soon enoughtaggartbg will become famous soon enough
Send a message via AIM to taggartbg Send a message via MSN to taggartbg Send a message via Yahoo to taggartbg
SetPWM and our IR controls

Hey everybody,

So I got the IR board programmed, got it all wired up to interface with the bot, coded it all out, and nothing happens. I currently only have one of the pins on the board (pin 5) running into the Digital In/Out (signal pin 1). I'm trying to get this working on a two-motor tank-drive bot with the '07 microcontroller. Here is my IR code:

Quote:
void OperatorController (void )
{
unsigned char ir1;
unsigned char ir2;
unsigned char ir3;
unsigned char ir4;

while ( 1 ) //I'm pretty sure I need this while loop, yes?
{
Tank2 ( 1 , 2 , 2 , 2 , 1 , 2 , 0 , 1);
ir1 = GetDigitalInput ( 1 ); //this should return "1" if it is getting signal, yes?
ir2 = GetDigitalInput ( 2 );
ir3 = GetDigitalInput ( 3 );
ir4 = GetDigitalInput ( 4 );

if ( ir1 == 1) //turn left at half speed
{
SetPWM ( 1 , 65 );
SetPWM ( 2 , 192 );
continue; //do I need this?
}

else if ( ir2 == 1) //straight at half speed
{
SetPWM ( 1 , 192 );
SetPWM ( 2 , 192 );
continue; //do I need this?
}

else if ( ir3 == 1) //turn right at half speed
{
SetPWM ( 1 , 192 );
SetPWM ( 2 , 65 );
continue; //do I need this?
}

else if ( ir4 == 1) //backwards at half speed
{
SetPWM ( 1 , 65 );
SetPWM ( 2 , 65 );
continue; //do I need this?
}

else //all stop
{
SetPWM ( 1 , 127 );
SetPWM ( 2 , 127 );
continue; //again, do I need this?
}
}
}
After a few attempts and nothing happing on the bot, I decided to try this simple code to start picking peice by peice what works and what doesn't:

Quote:
void OperatorController (void )
{
while ( 1 )
{
SetPWM ( 1 , 192 );
SetPWM ( 2 , 192 );
}
}
In theory, that should make the motors start moving forward at half speed yes? Well it just sits there doing nothing.


I was hoping someone could identify what exactly I'm doing wrong, as I am getting zero results from my bot.

Thanks,
/Taggart, team 1712
 


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
help us program our controls dude_brd Programming 1 10-02-2007 12:02
need help on programing our controls dude_brd Programming 1 07-02-2007 18:42
FRC: Reset and Program Controls yanksrock777 General Forum 4 24-01-2007 22:37
Push Button and Switch Suppliers for OI controls Goldberg204 Control System 8 11-01-2007 15:27
pic: 383`s controls and driver Manoel Robot Showcase 13 03-03-2005 00:57


All times are GMT -5. The time now is 23:21.

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