|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#46
|
|||||
|
|||||
|
Re: quick question: TIMERS
Huh? You are talking about the IO on the RC, right? In auto mode, the OI transmits inputs as neutural.
|
|
#47
|
||||
|
||||
|
Re: quick question: TIMERS
so it would be like:
#define digin10old then later on .... digin10old = (rc_dig_in10) putdata() |
|
#48
|
|||||
|
|||||
|
Re: quick question: TIMERS
Quote:
Contrary to an earlier post, the RC inputs such as rc_dig_in10 do work during autonomous mode, so there's no reason to do it this way. The advice to save the values for later use applies only to OI inputs (knobs and switches, mostly) that you want to use to configure autonomous operation. Also, variables in c aren't declared using #define statements. The proper syntax is not trivial, but it is not important here, since you don't need to use a variable for this purpose. |
|
#49
|
||||
|
||||
|
Re: quick question: TIMERS
so it would be done how then ?
|
|
#50
|
|||||
|
|||||
|
Re: quick question: TIMERS
Quote:
|
|
#51
|
||||
|
||||
|
Re: quick question: TIMERS
Code:
if (rc_dig_in18=1) {
if (cnttick < 34 )
{
pwm05 = 60;
}
if (cnttick > 35 )
{
pwm05 = 127;
}
if (cnttick < 30 )
{
pwm04 = 0;
}
if (cnttick < 32 )
{
pwm04 = 127;
}
//raises arm up for 40 ticks 1 second(s) /\ /\
// drive motors from here on out \/ \/
if (cnttick > 35 && cnttick < 90 )
{
pwm01 = 190;
}
if (cnttick > 35 && cnttick < 90 )
{
pwm02 = 190;
}
if (cnttick > 92 && cnttick <= 122)
{
pwm01 = 190;
}
if (cnttick > 92 && cnttick <= 122)
{
pwm02 = 53;
}
if (cnttick > 130 && cnttick < 160 )
{
pwm01 = 190;
}
if (cnttick > 130 && cnttick < 160)
{
pwm02 = 190;
}
if (cnttick > 163 && cnttick <= 183)
{
pwm01 = 190;
}
if (cnttick > 163 && cnttick <= 183)
{
pwm02 = 53;
}
if (cnttick > 223 && cnttick < 250 )
{
pwm01 = 190;
}
if (cnttick > 223 && cnttick < 250 )
{
pwm02 = 190;
}
if (cnttick > 255 && cnttick <= 275)
{
pwm01 = 190;
}
if (cnttick > 255 && cnttick <= 275)
{
pwm02 = 53;
}
}
else {
pwm01=210;
}
|
|
#52
|
||||
|
||||
|
Re: quick question: TIMERS
Quote:
Your code seems ok at first glance...why don't you put this statement in your Process_data function: printf("%d\n", (int)rc_dig_in18); Check the console printout while your program cable is plugged in. Make sure that it changes properly with the switch on your robot. Too improve efficiency: use else if statements. For example: if(ticks < 15) blah; else if (ticks < 35) blah; That will handle your decisions faster... Sorry again if I confused you eariler. ![]() |
|
#53
|
||||
|
||||
|
Re: quick question: TIMERS
Quote:
|
|
#54
|
|||
|
|||
|
you guys are all really smart...i need to learn this stuff, or else i don't get to be on my team next year
|
|
#55
|
|||||
|
|||||
|
Re: quick question: TIMERS
Quote:
What your first line should say instead is this: Code:
if (rc_dig_in18==1) {
Code:
if (rc_dig_in18) {
|
|
#56
|
||||
|
||||
|
Re: quick question: TIMERS
Quote:
Last edited by Xufer : 17-03-2004 at 21:39. |
|
#57
|
|||||
|
|||||
|
Re: quick question: TIMERS
Quote:
|
|
#58
|
|||||
|
|||||
|
Re: quick question: TIMERS
Quote:
Code:
// somehow get a number in the "auto" variable
auto = (rc_dig_in18<<2) | (rc_dig_in17<<1) | (rc_dig_in16);
// or whatever it takes to turn your switches into a value
if (auto==1)
{
// code for mode 1
}
if (auto==2)
{
// code for mode 2
}
// etc.
|
|
#59
|
||||
|
||||
|
Re: quick question: TIMERS
Quote:
Code:
On Off sw1 1 2 sw2 3 4 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Quick Question | Burgabot | Programming | 31 | 02-12-2003 19:22 |
| Quick <hr> question | Jack | Website Design/Showcase | 1 | 31-01-2003 22:19 |
| A quick question | Joelster | Technical Discussion | 6 | 10-02-2002 09:09 |
| quick question about qualifying points | Hymnson | General Forum | 4 | 25-09-2001 21:19 |
| Quick Question, i guess | Andrew Rudolph | Motors | 1 | 12-08-2001 14:39 |