Teensy 3.5 Unable to determine potentiometer's switch state on board startup.

Status
Not open for further replies.

jsureke

Member
Hi,
On my Teensy 3.5, I have a rotary potentiometer that includes a switch. I can tell if the switch is being turned on or off by checking Bounce.risingEdge() and Bounce.fallingEdge(). I can also set my volume based on the potentiometer output by checking analogRead(A1).

What I can't figure out is how to tell if the knob is on the on or off side of the switch when the board boots. I tried looking at the potentiometer value and presuming it is on (or off) based on what I get there, but it could be in the on position with the volume at zero, and when it is in the off position, there is apparently noise or whatever that sometimes reads non-zero.

I am having another issue that isn't as pressing right now, but the potentiometer's output reaches max (1023) at about the halfway point of the full rotation.
Help with either is appreciated, but the initial switch position is my primary issue right now.

Thanks.
Here is the potentiometer:
pot.jpg
 
HI,

have not tried it, but I guess something like
Code:
button.update();
int state = button.read();
should do it.

For the potentiometer values: How is it wired to the teensy?
 
Status
Not open for further replies.
Back
Top