|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#10
|
|||
|
|||
|
Re: Programming Help
{
static long timeCounter = 0; //this will count the number of 26.2ms ticks that have passed while (autonomous_mode) /* DO NOT CHANGE! */ { if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */ { Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */ if(timeCounter <= 115) //3 seconds / 26.2ms = 114.5 { pwm13 = pwm15 = 30; } else if(timeCounter <= 134) //we'll give the relays about .5 seconds to switch { pwm13 = pwm15 = 0; relay1_fwd = relay2_fwd = 1; } else { //put stuff to do after the other things here //you can also add more else-if statements to time other things } Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */ timeCounter++; //add one to the tick count } } } this should work fine - hope it helps! mmy motoors don't move |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming Compatition | Angela06 | Programming | 30 | 08-04-2005 23:12 |
| A few questions on programming the Control System | Avarik | Control System | 21 | 08-02-2004 11:42 |
| Pneumatics electrical wiring and programming | archiver | 2001 | 1 | 23-06-2002 23:10 |
| Error found in programming for the pump and pressure switch | sjharobotics | Programming | 4 | 06-02-2002 17:46 |
| pbasic programming | punarhero | Programming | 4 | 21-01-2002 23:32 |