Go to Post our electronics boards had begun to look like we'd planted a wire bush and it grew - daltore [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 16-02-2008, 15:48
Shivang1923 Shivang1923 is offline
I make robot go VROOM VROOM!
FRC #1923 (MidKnight Inventors)
Team Role: Programmer
 
Join Date: Feb 2008
Rookie Year: 2008
Location: West Windsor, NJ
Posts: 38
Shivang1923 has a spectacular aura aboutShivang1923 has a spectacular aura about
Thumbs up Programing IR board problem

Hey. We are trying to program autonimous with IR board.

here is our code:
Code:
 //**** Check the IR Sensor for a new command
  sensorReading  = PORTJ>>4;  // Combined digital inputs 15-18

  if (latch == 1) 
  {
    if (sensorReading == 0)
    {
      latch = 0; // Take only the 1st reading to avoid being caught by a half & half state of the IR sensor
    }
  }
  else if (sensorReading != 0)
  {
       latch = 1;

       if (sensorReading == 8)      IR_cmd = 1;
       else if (sensorReading == 4) IR_cmd = 4;
       else if (sensorReading == 2) IR_cmd = 2;
       else if (sensorReading == 1) IR_cmd = 3;

        printf("IR_cmd = %d\r\n", IR_cmd);
}

 switch(IR_cmd)
 {
    case 0:
  		break;

    case 1:
		if (counter <= 50)
		{
			pwm01 = pwm02 = 255;
			counter++;
		}
		else
		{
			counter = 0;
			pwm01 = pwm02 = 127;
		}
	    break;

    case 2:
       pwm01 = 200;
       pwm02 = 55;
       break;

    case 3:
        pwm01 = 55;
        pwm02 = 200;
        break;

    case 4:
        relay1_fwd = 1;
    }
This one loops forever. The problem is the counter = 0;.
If we remove it, the motors never stop moving

We want to have it configured so if button one is pressed, it will move forward for x seconds, and so on for the rest.


another problem is that the relay will not fire.

Any help will be appreciated. Thank you.
 


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
IR board problem AmitCarmeli Electrical 3 09-02-2008 18:53
Another IR Board Problem C222 Electrical 2 13-01-2008 17:36
Do you have a problem with the IR Board? DonRotolo Control System 5 07-01-2008 23:57
Lights in Joystick board or control board rcubes85 Control System 15 26-02-2005 23:40
Perf Board = BS2-IC Carrier Board? indieFan Electrical 2 16-09-2004 08:28


All times are GMT -5. The time now is 20:26.

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