|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
potentiometer/ analog inputs
We are having trouble getting our potentiometer code to work.
we declare it AnalogInput *potemtiometer; later potentiometer = new AnalogInput(2); and we can't figure out the last part. We don't have anything to go off of because last year was an easy 1,2,3 robot. |
|
#2
|
|||
|
|||
|
Re: potentiometer/ analog inputs
try using AnalogChannel instead of input
|
|
#3
|
|||
|
|||
|
Re: potentiometer/ analog inputs
okay we'll try that.
|
|
#4
|
|||
|
|||
|
Re: potentiometer/ analog inputs
attempting analog channel didn't work when we added
float anglesh = pot1.GetVoltage(); |
|
#5
|
|||
|
|||
|
Re: potentiometer/ analog inputs
shouldn't it be pot1->GetVoltage();?
|
|
#6
|
|||
|
|||
|
Re: potentiometer/ analog inputs
i'm trying to make the code right and it compiles but we'll see if i get something.
i haven't actually had a potentiometer until now. |
|
#7
|
|||
|
|||
|
Re: potentiometer/ analog inputs
1075guy is right, because you declared it using a pointer you must use -> instead of .
|
|
#8
|
||||
|
||||
|
Re: potentiometer/ analog inputs
use pot1->GetValue() for a 0-1023 range value, pot1->GetVoltage() for 0.0-5.0 range. Try both and see which one you like better
|
|
#9
|
|||
|
|||
|
Re: potentiometer/ analog inputs
i try printing the values to the screen and i get really big values sometimes. Why would this be? is it because i might run the loops they are in too quuickly. i set them to .02 seconds and i think its doing better.
I actually disabled the watchdog for the autonomous because it won't run through long waits in the system. this worked until just now when it started giving me watchdog not fed errors that have never happened before. |
|
#10
|
|||||
|
|||||
|
Re: potentiometer/ analog inputs
Perhaps there's a digit or two left over on the screen from a previous print step? For example, if one value is 1003 and the next one is 996, it might end up on screen looking like 9963 if you aren't careful.
|
|
#11
|
|||
|
|||
|
Re: potentiometer/ analog inputs
this could be i will try to fix this.
would printing printf(" =angletop"); printf("%d",angletop); would this work in the correct format assuming it prints on line 1 and the %d writes over it? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help! Analog Inputs!! | brennerator | Programming | 7 | 11-02-2007 15:48 |
| Analog Inputs | bush | Programming | 5 | 13-03-2006 17:49 |
| Analog Inputs prob. | Bharat Nain | Programming | 2 | 07-02-2004 20:48 |
| Failing analog inputs? | Phasmatis568 | Control System | 5 | 22-01-2004 13:28 |
| Analog Inputs | 316_programer | Technical Discussion | 2 | 05-02-2002 05:53 |