Go to Post Every time i look at my watch and see 3:65 o'clock I always thing, darn i gotta get a new watch... - Kyle [more]
Home
Go Back   Chief Delphi > Technical > intelitek easyC/REC information > easyC PRO
Team 51   CD-Events   CD-Media   CD-Swap   CD-Spy   FRC-Spy   Unsung FIRST Heroes   WFA
portal register members calendar search Today's Posts Mark Forums Read FAQ rules
Innovation First International, Inc.
The Chief Delphi Forums are sponsored by Innovation First International, Inc.
BAE Systems
ADVERTISEMENT

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-14-2008, 03:22 PM
ShotgunNinja's Avatar
ShotgunNinja ShotgunNinja is offline
Vice-President, SCOE Robotics
AKA: Nicholas Iannone
no team (SCOE Robotics)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Kenosha, WI
Posts: 140
ShotgunNinja is a jewel in the roughShotgunNinja is a jewel in the roughShotgunNinja is a jewel in the roughShotgunNinja is a jewel in the rough
Question Help with Hybrid code

I have been having trouble with my Hybrid mode setup. I'm not sure what exactly is the problem, but I have been led to believe it is my sometimes flawed programming. (See my other posts if you don't believe me). I am using the provided IR board, and with a regular IR remote setup, for a VCR remote. The outputs are (supposedly) wired into Digital In/Out ports #1-4, and the IR board is receiving power.

Here is my code (it's a bit un-simplified, so propagators of KISS please don't complain too much)

Code:
/* Some globals: */
unsigned char offsensor1;
unsigned char offsensor2;
unsigned char offsensor3;
unsigned char offsensor4;

/* Initialize */
void Initialize(void)
{
   InitIRSensor();
   /* ... */
}

/* InitIRSensor */
void InitIRSensor(void)
{
   offsensor1 = GetDigitalInput(1);
   offsensor2 = GetDigitalInput(2);
   offsensor3 = GetDigitalInput(3);
   offsensor4 = GetDigitalInput(4);
}

/* Autonomous */
void Autonomous(void)
{
   unsigned char irsensor1;
   unsigned char irsensor2;
   unsigned char irsensor3;
   unsigned char irsensor4;
   int action = 0;
   
   while( IsAutonomous() )
   {
      irsensor1 = GetSensorInput(1);
      irsensor2 = GetSensorInput(2);
      irsensor3 = GetSensorInput(3);
      irsensor4 = GetSensorInput(4);
      if ((irsensor1 + irsensor2 + irsensor3 + irsensor4) >= 2)
      {
         action = 0;
      }
      else if (irsensor1)
      {
         action = 1;
      }
      else if (irsensor2)
      {
         action = 2;
      }
      else if (irsensor3)
      {
         action = 3;
      }
      else if (irsensor4)
      {
         action = 4;
      }
      else
      {
         action = 0;
      }
      HybridAction(action);
   }
}

/* GetSensorInput */
unsigned char GetSensorInput(int sensorPort)
{
   unsigned char value;
   switch(sensorPort)
   {
      case 1:
      {
         value = offsignal1;
         break;
      }
      case 2:
      {
         value = offsignal2;
         break;
      }
      case 3:
      {
         value = offsignal3;
         break;
      }
      case 4:
      {
         value = offsignal4;
         break;
      }
   }
   return(GetDigitalInput(sensorPort) == value);
}
__________________


2006-2007: My FIRST Experience - School Mascot for Team 1652 at the Wisconsin Regional
2007-2008: FIRST Year on the Team and already in Overdrive - Programmer for Team 1652 (Robot Mafia) at the Wisconsin Regional - Finalists
2008-2009: Senior Year is Lunacy! - Lead Programmer on Team 1652 (Robot Mafia) - Midwest Regional (Semifinalists), Milwaukee Regional (4th Seed) AND Rookie Team 2970 (eSchool eBots) - Milwaukee Regional (3rd Seed, Finalists), Minneapolis North Star Regional (5th Seed, Winners, Rookie All-Star winners), Championship Newton (7th Seed, Semifinalists)
2009-2010: To be continued... as a Mentor?

I still have the original 2007-2008 FIRST IR sensor prototype. It's sitting on my bookshelf.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-15-2008, 12:42 PM
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 858
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Help with Hybrid code

Check the on-line window and see if your sensor is working. You should see ports 1-4 reading 0. When the button is pressed on your remote, the indicator should swap to 1 while the LED is on.
__________________
Intelitek Support

[BFIRST Team 146 Blue Lightning - Alumni[/b]
FIRST Team 40 Checkmate
Reply With Quote
Reply


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 with VB code Setsanto Programming 8 02-08-2007 03:04 PM
Help with code b-rant Programming 1 04-05-2006 12:52 PM
Need help with code CaseyKasem_1251 Programming 3 02-18-2006 08:39 AM
Help With Compressor Code fred Programming 6 01-21-2005 04:40 PM
hey need some help with writing a code please help me here magical hands Programming 9 01-01-2004 08:46 PM


All times are GMT -5. The time now is 06:09 AM.

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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © Delphi and Pontiac Central High School