|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Programming question
A couple of weeks ago, I wrote some code just to test out motor direction and then from there decided to write "real" code in the same file. Because easyC does not allow me to edit the text, I couldnt find a way to comment the test section of the code so I just made it an invalid while loop. (while(1==0)).
So when I ran the code, I noticed there was a rhythmic beep and silence pattern which corresponded to the same type of rhythmic motor control and lack of control. I figured out that it was the invalid while loop that was doing it. Now I am experiencing a similar problem, but the rhythm of no control is much shorter. The only part of the code that would ever not be operation is a fairly large if statement. Is it possible for that if statement to cause a break in the code? Or could it have something to do with an undefinied variable? #include "UserAPI.h" int a = 0; int b = 0; int c = 0; void main ( void ) { while ( 1 ) { MotorRcControl ( 0 , 2 , 3 , 0 ) ; MotorRcControl ( 0 , 3 , 4 , 1 ) ; MotorRcControl ( 0 , 6 , 1 , 1 ) ; a = GetRxInput ( 1 , 5 ) ; if ( a>127 ) { SetPWM ( 2 , 160 ) ; PrintToScreen ( "154\n" ) ; } else { if ( a<127 ) { SetPWM ( 2 , 90 ) ; PrintToScreen ( "100\n" ) ; } else { SetPWM ( 2 , 127 ) ; PrintToScreen ( "127\n" ) ; } } b = GetRxInput ( 1 , 6 ) ; if ( b>127 ) { SetPWM ( 1 , 144 ) ; } else { if ( b<127 ) { SetPWM ( 1 , 110 ) ; } else { SetPWM ( 1 , 127 ) ; } } } } |
|
#2
|
||||
|
||||
|
Re: Programming question
There is a way to comment out code in EasyC, right click on an item in the flowchart and select "comment out". Try seeing if the actual comment out takes care of things.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VEX programming | Gene F | Programming | 14 | 08-08-2006 22:21 |
| Servo behavior question / advanced servo/PIC programming question | DanL | Electrical | 12 | 18-10-2005 18:33 |
| have a question to ask about Double Solenoids to one spike programming | davelu | Programming | 3 | 22-02-2005 09:52 |
| General programming question | mikesown | Programming | 1 | 07-02-2005 16:09 |
| 'Fix It Window' and Programming.... | JMac | Programming | 19 | 25-01-2005 18:57 |