|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Testing for bits in EasyC
my team wants to use the USB chicklet with the x-box360 controller
in the FIRSTwiki it explains how to test an individual bit in MPLab I would like to make sure that code like the following is supported in EasyC #define BUTTON_5 ((~p1_wheel &0x80)!=0) I think it should work but there might be some obscure reason why it might not Confirmations with reasons or denials would be great! Thank you in advance! |
|
#2
|
||||
|
||||
|
Re: Testing for bits in EasyC
Paul recommend we use
dpad_top = (GetOIAInput ( 1 , 3 )&1<<7)?0:1 ; dpad_bottom = (GetOIAInput ( 1 , 3 )&1<<6)?0:1 ; dpad_left = (GetOIAInput ( 1 , 3 )&1<<5)?0:1 ; dpad_right = (GetOIAInput ( 1 , 3 )&1<<4)?0:1 ; left_top = (GetOIAInput ( 1 , 4 )&1<<7)?0:1 ; right_top = (GetOIAInput ( 1 , 4 )&1<<6)?0:1 ; left_trigger = (GetOIAInput ( 1 , 4 )&1<<5)?0:1 ; right_trigger = (GetOIAInput ( 1 , 4 )&1<<4)?0:1 ; I'm not sure how to properly define this so the compiler does barf but if you can do it in C you can do it in easyC edit: I got it to work I think... Click on the projects tab and paste: #define BUTTON_5 ((~GetOIAInput ( 1 , 3 ) &0x80)!=0) // same as p1_wheel Into UserInclude.h Also the Xbox controller itself isn't the best unit the thumbsticks stick and don't recenter well. The Logictech "PS2" like controller works better. Last edited by Kingofl337 : 18-01-2008 at 22:18. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pic: Almost ready for testing | Doug G | Robot Showcase | 4 | 04-02-2006 18:49 |
| How do i connect the camera for testing? | naor52 | Programming | 1 | 12-01-2006 01:11 |
| Testing Motor for Specs? | indieFan | Motors | 12 | 07-11-2004 18:36 |
| Budget OI/RC for testing | Racer26 | General Forum | 1 | 09-07-2004 21:15 |
| Tips for Sensor Programming and Testing | EricEnsor | Programming | 3 | 24-01-2003 11:28 |