Forum Rule: Always post complete source code & details to reproduce any issue!
-
Teensy 3.5 Unable to determine potentiometer's switch state on board startup.
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:
-
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?
-
Do not connect it to 5V or VIN, use 3V
-

Originally Posted by
Frank B
button.read()
Exactly what I needed. Thanks.

Originally Posted by
Frank B
Do not connect it to 5V or VIN, use 3V
I have it on VUSB right now, but I'll switch it to 3.3.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules