|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#2
|
||||||
|
||||||
|
Re: Shifting with easyC
Quote:
For example rather than: If (switch==1) then PWMout = XXX else PWMout = YYY I do this: If (switchNow==1 and switchOld==0) then PWMout=XXX Elseif (switchNow==0 and switchOld==1) then PWMout=YYY The second case allows you to have other conditions change the state of the PWMout. If you do things this way, what you want to do becomes trivial: If (switchNow==1 and switchOld==0 and PWMout=XXX) then PWMout=YYY Elseif (switchNow==1 and switchOld==0 and PWMout=YYY) then PWMout= XXX The above pseudo code will allow you to use your switch to toggle between XXX & YYY states. There are probably better ways to do this but I hope this will give you some idea of how it can be done. Joe J. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EasyC Wish List | dcbrown | Programming | 32 | 14-08-2006 09:24 |
| EasyC v2.0 is mandatory for FVC! | skimoose | FIRST Tech Challenge | 7 | 14-01-2006 18:37 |
| Kickoff easyC workshop integrated into EasyC help file | Dan Larochelle | Programming | 0 | 11-01-2006 06:12 |
| Is a shifting transmission really necessary? | Jay TenBrink | Technical Discussion | 78 | 02-08-2005 09:21 |