|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
I am trying to look at the values i get with a potentiometer through the dashboard, but my attempts are ending in failure.
So is there some special code that have to put in so that i can read it or is it because i have it plugged in the wrong spot. anyone know the solution? ![]() |
|
#2
|
|||||
|
|||||
|
Re: coding a potentiometer
Quote:
once you do that use this code: (assuming you connected it to analog input #1) Code:
pot1=Get_Analog_Value(rc_ana_in01);
printf("pot1=%d \r ",pot1);
-Leav |
|
#3
|
|||||
|
|||||
|
Re: coding a potentiometer
Do you have to pot attached to the OI or attached to the RC?
You could have a wiring problem with the pot in either place, so double check the OI or RC specs for correct wiring. The dashboard display for the OI comes setup to show the joystick port pot values as a range from 0-254. For the RC dashboard screen you'll have to scale the pot (0-1023) to the range (0-255) and set one of the User_Byte's (1-6) to that value. |
|
#4
|
|||||
|
|||||
|
Re: coding a potentiometer
Quote:
Code:
User_Byte1 = value >> 8;
User_Byte2 = value & 255;
|
|
#5
|
|||||
|
|||||
|
Re: coding a potentiometer
Just bitshift it twice (from a 10 bit to an 8 bit number)
Code:
POT = Get_Analog_Value(rc_ana_in01) >> 2; |
|
#6
|
|||||
|
|||||
|
thanks, that situation has been taken care off. appreciate greatly.
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP Coding HELP!!! | FRANK(WGH) | Website Design/Showcase | 9 | 26-01-2005 17:18 |
| Potentiometer | Joshua May | Technical Discussion | 8 | 22-05-2004 19:51 |
| Potentiometer with BS2 | sanddrag | Programming | 7 | 13-05-2004 19:21 |
| Coding / Style Standards for sharing C code | Joe Johnson | Programming | 33 | 01-05-2004 15:15 |
| Potentiometer Problem | Greg | General Forum | 1 | 15-02-2003 18:10 |