how do I use buttons to control digital potentiometers?
paulmcco
Posts: 1
What I have set up are two buttons and a AD5220 digital potentiometer connected to a BS2/IC.
I would like to use one button to make the digital pot go down(towards A terminal) and the other to make the digital pot go up(towards B terminal).
I need the two buttons to run at the same time( I need to be able to choose either up or down without using separate programming instructions. If you know of any way to do this please send an e-mail to lsm788@cs.com. Thanks!
-Paul
I would like to use one button to make the digital pot go down(towards A terminal) and the other to make the digital pot go up(towards B terminal).
I need the two buttons to run at the same time( I need to be able to choose either up or down without using separate programming instructions. If you know of any way to do this please send an e-mail to lsm788@cs.com. Thanks!
-Paul
Comments
·· You can read more than one pushbutton at the same time by reading the port directly, then branching based on the value:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Ordinarily this should be a straightforward task:
You have the stamp periodically check the state of the two buttons,
If one changes, you determine which one,
You pulse the digital pot accordingly.
But your statement:
( I need to be able to choose either up or down without using separate programming instructions.
Gives me pause. Can you elaborate on your requirement that you cant use "separate programming instructions"?
Bruce
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Name: Bruce Clemens
Work:· Clemensb@otc.edu
Good Stuff on my Blog: http://theDeadBug.journalspace.com
In Chapter 2, Activity #4, there's a program called PushbuttonControlofTwoLeds. In Chapter 9, Activity #2, there's a program called DigitalPotUpDown.bs2.
Take the elements of DigitalPotUpDown.bs2 that increment the AD5220's wiper up and down and insert them into the IF...ELSEIF...ELSE...ENIDIF statement in PushbuttonControlOfTwoLeds.bs2.
When you're done, instead of pushbutton controlling LEDs, you will pushbutton control the digital potentiometer.