Convert Variable Sensor Value to High/Low Signal for HID

For the purpose of building a game controller I need to find a way to take an analog value from a pot or a transducer and interpret it as a high/low signal as if I'm simply pushing a momentary button.

I've been working with an UNO for this project and I think I've realized what I need a Leonardo so I just ordered one to play with.

I'm fairly new to this so please be patient.

I wouldn't bother using extra electronic components to do the converting to hi/lo. I'd just read the analog valje and convert it in the program to 1 or 0, true or false.

I think the answer hit me right after I submitted the question lol

It's essentially this

I do need to learn how to sketch this for multiple inputs.

Yeah dude. It's all in the code.

Val = digitalread(potPin);
Val = map(val, 0, 1024, 0, 1);

That will basically make it so that if the potentiometer is more than 50% turned it will show a digital 1 and if it's less than 50% vice versa. You just gotta name your pot potPin. And your good to go


if(analogRead(pin) > 512) {
// you have a one
else {
// you have a zero

Thanks guys!