|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
Re: Help! Programming question with triggers
startup meaning when i turn the robot on?.... nope they dont move
|
|
#17
|
|||||
|
|||||
|
Re: Help! Programming question with triggers
if you push it in reverse and let go does it keep going in reverse? or go forward?
[EDIT] I also think it is a switch wiring problem [/EDIT] Last edited by The Lucas : 17-03-2004 at 21:24. |
|
#18
|
|||
|
|||
|
Re: Help! Programming question with triggers
the thing is that....the SAME EXACT thing happens when i hooked up a joystick to it...so i doubt its an electrical problem.
*EDIT - using the triggers from a joystick Last edited by AsimC : 17-03-2004 at 21:31. |
|
#19
|
|||||
|
|||||
|
Re: Help! Programming question with triggers
Could you post the file then? The algorithms on this thread are good so the problem is somewhere else. I am sure with all the CD programmers someone will find it real quick.
|
|
#20
|
||||
|
||||
|
Re: Help! Programming question with triggers
Quote:
the reason why your motors keep running is because there is no path in your code where you tell them to be = 127 and stop running the way your code is written if neither switch is closed then the pwm outputs will still be what they were the last time the loop ran, and the time before that... your code leaves them at 175 or 90. you could put pwm07=127; pwm08=127; above your if statement - have them = 127 by default, then if either switch is closed they will be something else instead this is a common mistake Last edited by KenWittlief : 17-03-2004 at 22:19. |
|
#21
|
||||
|
||||
|
Re: Help! Programming question with triggers
try this its the code i use to run my claw modified for your application
Code:
pwm07=127;
pwm08=127;
if (p3_sw_top)
{ pwm07 = 90;
pwm08 = 90; }
else if (p3_sw_trig)
{ pwm07 = 175;
pwm08 = 175;}
|
|
#22
|
||||
|
||||
|
Re: Help! Programming question with triggers
Here is how i would write it if i were you guys....
if ( 0 != p3_sw_trig) { pwm07 = 175; pwm08 = 175; } else if (0 != p3_sw_top) { pwm07 = 90; pwm08 = 90; } else { pwm07 = 127; pwm08 = 127; } When writing my code i didnt do p3_sw_top == 1, my mentor sez its better to do 0 !=, and i have no idea why. try this, if it works yay! if not sorry i couldnt be of more help |
|
#23
|
||||||
|
||||||
|
Re: Help! Programming question with triggers
Quote:
|
|
#24
|
|||||
|
|||||
|
Re: Help! Programming question with triggers
Code:
pwm07 = pwm08 = 127 + ((p3_sw_trig - p3_sw_top) * 40); -Kesich |
|
#25
|
||||
|
||||
|
Re: Help! Programming question with triggers
Oh my god!
So concise, so effective, so 1337! I salute you Anthony, you truly embody the spirit of first. |
|
#26
|
||||
|
||||
|
Re: Help! Programming question with triggers
it is concise in C - but unless the CPU has a HW multiplyer then multiplyer that one line of code might compile into something that will take hundreds of machine cycles to execute in assembler
when you only need an '=' getting clever to make your C look concise is usually a big mistake. |
|
#27
|
|||||
|
|||||
|
Re: Help! Programming question with triggers
Quote:
Processor speed is a different story and depends on the processor architecture. Last edited by The Lucas : 18-03-2004 at 11:10. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Digital In Question | Tom Bottiglieri | Control System | 5 | 02-03-2004 17:09 |
| Urgent!! (programming question) | anupalsingh | Programming | 6 | 25-02-2004 10:53 |
| MIM's question of the day on programming. | Gene F | Programming | 3 | 24-02-2004 16:32 |
| C Programming Question | tophq | Programming | 7 | 16-02-2004 12:56 |
| Programming question | archiver | 2001 | 6 | 23-06-2002 22:57 |