I would like to use an FSR as an on/off switch. I want to implement it using an 8-bit 328p processor (either on an Arduino or an AtMega.) I'm using a voltage divider between the FSR and a 10K ohm resistor.
The idea is the following: When you finger-tap the FSR the voltage across the 10kΩ resistor (in series with the FSR) will increase up to a desired threshold voltage (any number between 1V-3V will do it.) Once it reaches the right threshold voltage, I want it to set a pin as an output, and be able to turn on a tiny DC-motor for x second (or x rotations.)
I believe that to read the right threshold voltage I have to start an ADC conversion on the ADC multiplexer selection register, but I'm confused on how I should implement it.
Here is how I'm planning to calculate the threshold voltage for the ADC:
I don't know how to make a register take the calculated value for the threshold voltage ADC.