|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
Joystick Button programming
Hi guys,
I have run into a sort of stupid problem. I can't get the buttons on the joystick to work. Code:
if (p1_sw_top ==1)
{
pwm01=200;
}
Code:
//Somewhere in the top of the file
int output =0;
//Down in the file
output = p1_sw_top;
if (output = 1)
{
pwm01=200;
}
|
|
#2
|
||||
|
||||
|
Re: Joystick Button programming
Is it compiling correctly? Before you start yelling, let me explain..... We were programming along over the weekend when things started going crazy on our robot. It took about 30 minutes before I realized that I was getting a compile error, but it was still building the .hex file for me to download even though it should abort. Double check for any error messages when you do your 'Make All' just in case.
Other than that, desk check your code and make sure you are actually getting to the the lines you are trying to run. Trust me, I've added the greatest routines ever written to some of my software over the years, only to have them not execute because I put them in the wrong place in my code. It's quite embarrassing when your boss is expecting to see a simulated missile attack show up on the screen and nothing happens! |
|
#3
|
||||
|
||||
|
Re: Joystick Button programming
Hi,
Here is a couple of things to consider. 1. Try a different joystick to verify that is okay. 2. Modify the code to do something like this... Code:
if (p1_sw_top == 1) pwm01 = 254; else pwm01 = 0; 4. Try a different port to verify port 1 does not have a problem. Let us know what you have learned. Regards, ChuckB |
|
#4
|
|||||
|
|||||
|
Re: Joystick Button programming
I have tried different ports, buttons, joysticks.. it still doesnt work. I do agree I did not check to see if it builds correctly, but how do I tell? Here is the last output summary when I was building:
Code:
Clean: Deleting intermediary and output files. Clean: Deleted file "C:\2005 Programming\frcV24\frc\main.o". Clean: Deleted file "C:\2005 Programming\frcV24\frc\user_SerialDrv.o". Clean: Deleted file "C:\2005 Programming\frcV24\frc\user_routines.o". Clean: Deleted file "C:\2005 Programming\frcV24\frc\user_routines_fast.o". Clean: Deleted file "C:\2005 Programming\frcV24\frc\ifi_utilities.o". Clean: Deleted file "C:\2005 Programming\frcV24\frc\ifi_startup.o". Clean: Deleted file "C:\2005 Programming\frcV24\frc\user_camera.o". Clean: Deleted file "FrcCode.cof". Clean: Deleted file "FrcCode.cod". Clean: Deleted file "FrcCode.hex". Clean: Deleted file "FrcCode.lst". Clean: Deleted file "C:\2005 Programming\frcV24\frc\FrcCode.mcs". Clean: Done. Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "main.c" -fo="main.o" /i"C:\mcc18\h" -D_FRC_BOARD -D_USE_CMU_CAMERA -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066 Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "user_SerialDrv.c" -fo="user_SerialDrv.o" /i"C:\mcc18\h" -D_FRC_BOARD -D_USE_CMU_CAMERA -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066 Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "user_routines.c" -fo="user_routines.o" /i"C:\mcc18\h" -D_FRC_BOARD -D_USE_CMU_CAMERA -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066 Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "user_routines_fast.c" -fo="user_routines_fast.o" /i"C:\mcc18\h" -D_FRC_BOARD -D_USE_CMU_CAMERA -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066 Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "ifi_utilities.c" -fo="ifi_utilities.o" /i"C:\mcc18\h" -D_FRC_BOARD -D_USE_CMU_CAMERA -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066 Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "ifi_startup.c" -fo="ifi_startup.o" /i"C:\mcc18\h" -D_FRC_BOARD -D_USE_CMU_CAMERA -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066 Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8520 "user_camera.c" -fo="user_camera.o" /i"C:\mcc18\h" -D_FRC_BOARD -D_USE_CMU_CAMERA -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- -nw=2066 Executing: "C:\mcc18\bin\mplink.exe" /l"C:\mcc18\lib" "18f8520user.lkr" "C:\2005 Programming\frcV24\frc\main.o" "C:\2005 Programming\frcV24\frc\user_SerialDrv.o" "C:\2005 Programming\frcV24\frc\user_routines.o" "C:\2005 Programming\frcV24\frc\user_routines_fast.o" "C:\2005 Programming\frcV24\frc\ifi_utilities.o" "C:\2005 Programming\frcV24\frc\ifi_startup.o" "C:\2005 Programming\frcV24\frc\user_camera.o" "C:\2005 Programming\frcV24\frc\FRC_library.lib" /o"FrcCode.cof" MPLINK 3.90, Linker Copyright (c) 2004 Microchip Technology Inc. Errors : 0 MP2COD 3.90, COFF to COD File Converter Copyright (c) 2004 Microchip Technology Inc. Errors : 0 MP2HEX 3.90, COFF to HEX File Converter Copyright (c) 2004 Microchip Technology Inc. Errors : 0 Loaded C:\2005 Programming\frcV24\frc\FrcCode.cof BUILD SUCCEEDED: Fri Feb 18 09:28:05 2005 Thanks for all the help you guys are offering, -Bharat |
|
#5
|
|||||
|
|||||
|
Re: Joystick Button programming
Code:
if (p1_sw_top ==1)
{
pwm01=200;
}
Code:
//Somewhere in the top of the file
int output =0;
//Down in the file
output = p1_sw_top;
if (output = 1)
{
pwm01=200;
}
|
|
#6
|
||||
|
||||
|
Re: Joystick Button programming
have you tried doing this?
Code:
if (p1_sw_top ==1)
{
pwm01=200;
}
pwm01=200;
this way, if there's anything that would change pwm01's values, you will know, because the robot will still not move. if it does move, well then move on to another solution. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming motors with joystick buttons | TMHStitans | Programming | 5 | 21-03-2005 21:07 |
| Joystick Button Deference | cibressus53 | Electrical | 3 | 01-11-2004 09:38 |
| single joystick programming | Bill Bonsky | OCCRA | 2 | 04-10-2003 09:47 |
| Programming the second joystick in PBASIC | archiver | 2001 | 2 | 24-06-2002 00:25 |
| Arm Rotation (1 Button Programming!!) | Joelster | Technical Discussion | 1 | 14-02-2002 13:15 |