|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
I've been searching the forums for remedies to why we can't make our IR Board work. And i've found some that for me have had no effect on the performance of our motors. Right now to test if we can program anything to correspond with the signals that tie IR board reveives/gives, we inserted the following code:
Code:
if (rc_dig_in07 = 0)
{
ButtonPressed = TRUE;
if (ButtonPressed = TRUE)
{
pwm01 = pwm02 = 127;
}
}
Any suggestions for resources or troubleshooting options?? Thanks, Team 2348 Last edited by darkdwarven : 30-01-2008 at 00:25. |
|
#2
|
|||||
|
|||||
|
Re: ir sensor Board ??????????????????????
This tries to assign the value 0 to the rc_dig_in07 variable. It also has the side effect of never being true. You want instead to test for equality.
In short, replace the = with ==. Some people use the technique of always putting the constant on the left in a test like this. That way the compiler will notice and complain if you accidentally use a single equals sign. Oh, and your test is backwards. The IR receiver board outputs 0 when nothing is detected, and gives a 100 millisecond 1 pulse when a valid signal is received. Last edited by Alan Anderson : 30-01-2008 at 08:05. |
|
#3
|
|||
|
|||
|
Re: ir sensor Board ??????????????????????
I was trying the following for our IR board and nothing seems to happen
if (rc_dig_in15 == 1) { pwm_13 = 256; } This was just to test if pressing a button on the remote did anything (the remote was already programmed etc,.) is there anything wrong that we are doing? This snippet was placed in the user_routines.c is that the correct place or should it be under user_routines_fast.c? Thanks for any help |
|
#4
|
||||
|
||||
|
Re: ir sensor Board ??????????????????????
Quote:
I am not 100% positive on this, but here is my thoughts and what to try. The rc_dig_in7 - 18 are tied high when they are set as inputs. If they are considered active when a switch is closed across them to ground, and the output of the IR board goes high when it is active, then you need to test for a !rc_dig_inxx. So try: Code:
if (rc_dig_in15 == 0)
{
pwm_13 = 256;
}
Code:
if (!rc_dig_in15)
{
pwm_13 = 256;
}
Again, I am not a pro at this, just a learner at this point. BTW, the signal will pulse, so hold the button down. |
|
#5
|
||||
|
||||
|
Re: ir sensor Board ??????????????????????
Try this code on a post I made a few days ago. Use MPLAB and add it to the autonomous program. Put whatever you want the robot to do under mode 1 ,mode 2, or mode 3.
http://www.chiefdelphi.com/forums/sh...1&postcount=19 |
|
#6
|
|||||
|
|||||
|
Re: ir sensor Board ??????????????????????
Quote:
Quote:
|
|
#7
|
||||
|
||||
|
Re: ir sensor Board ??????????????????????
Quote:
no......the maximum pwm value is 256......its an extrema |
|
#8
|
||||
|
||||
|
Re: ir sensor Board ??????????????????????
Actually, the maximum PWM value is 255, or 2^8 - 1, which is the maximum value that can be held in 8 bits of memory - the size of an unsigned char. Going above this will cause an overflow problem, where you'll loop around and start at 0 again.
|
|
#9
|
||||
|
||||
|
Re: ir sensor Board ??????????????????????
We were trying to find a way to program the Robot Cotroller so that when any of 2 inputs receive a signal, it will leave the autonomous code and enter a 'maual' autonomous code. The manual autonomous code would work based on 2 if statements that loop back to the other. The if statements would either say left or right and cotinue until our timer value ran out. Our code in the attached file, only makes the motors pulse for some other direction or go to one and continue straight without any further response. Any problems with our coding? Also does anyone know an easier way of accomplishing the same tasks?
Thanks always for the help, Team 2348 |
|
#10
|
|||
|
|||
|
Re: ir sensor Board ??????????????????????
Quote:
I placed it under Default_Routine() is that the wrong place? I couldnt find a function called Process_Data_From_Local_IO(), in user_routines.c |
|
#11
|
|||||
|
|||||
|
Re: ir sensor Board ??????????????????????
If your goal is to test the ability to use IR commands to control motors, that's probably the right place to put it.
But you need to make sure that the pwm outputs you set don't get set to something else later on. You can do that most easily by putting the IR sensing code near the end of the function, so it gets the last opportunity to force the motors to move as you want. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wiring the IR sensor board | govvijay | Programming | 9 | 05-02-2008 19:41 |
| Technical Details for the IR sensor board | tuzzer | Electrical | 1 | 19-01-2008 08:38 |
| How to program ir sensor board?? | RRA4LIFE2 | Programming | 1 | 11-01-2008 21:47 |
| Perf Board = BS2-IC Carrier Board? | indieFan | Electrical | 2 | 16-09-2004 08:28 |
| Making a Sensor Board | SpaceOsc | Technical Discussion | 11 | 15-05-2004 12:46 |