Potentiometer rctime?
johnproko
Posts: 121
I want to get a result depending where the potentiometer is.
yet i get a value up to a point and then 0s. it is a 10k. as see in the picture i get a value from the start and counterclockwise almost up to half.
any ideas?[img][/img]
the code is a simple rctime for the BS2
r var word
do
high 7
pause 1
rctime 7, 1, r
debug home, cls, dec5 r
pause 100
loop.
yet i get a value up to a point and then 0s. it is a 10k. as see in the picture i get a value from the start and counterclockwise almost up to half.
any ideas?[img][/img]
the code is a simple rctime for the BS2
r var word
do
high 7
pause 1
rctime 7, 1, r
debug home, cls, dec5 r
pause 100
loop.
Comments
You're not going to be able to get useful readings over the whole range of the pot. You can do better by having several capacitors and switching the additional capacitors in and out of the RC circuit under control of the Stamp. You can also restrict the motion of the pot to a smaller range.
Edit: Tomcrawford nailed it, ignore my ramblings.
Use the middle pin for the pin connction and one of the others for the ground.
Connect a simple capacitor between them and that is all.
depending on which outer pin you connect the ground will work for the starting point.
the values are in all the spectrum of the potentiometer and will go (for mine at least) from 1 to 60.
It goes from 1 to 60 this allows the user to make ratios for usage with other items such as leds. Motors need a smaller total resistor. If you use too much then it will work for only a small movement of the pot.
Have you looked at Activity #4 in Chapter 5 of What's a Micrcontroller? (page 156); It shows how to Scale the potentiometer value for a Servo.
Activity #3 (page 150) also shows how the capacitor value affects the range of RCTIME values that are returned.
https://www.parallax.com/sites/default/files/downloads/28123-Whats-a-Micro-v3.0.pdf