Analog Input
First, connect the LED light and resistor to D9 port of Arduino.
Then, connect the potentiometer to the A0 port.
Next, program in Arduino. I think I still need to better understand what the code means.
Results :) the LED dims up and down as I turn the pot.
Analog Output with Tone
Breadboard connection: force sensing resistor to A0 and the speaker to D8.
Programming in Arduino to check that the speaker works.
When I run this sketch, I did hear a tone of 44oHz, or middle A, continually!
However, the next step is to integrate the force sensor - I had a few attempts on the code and never worked :(
How I solved the problem: first added the pinMode(8, output) in the setup, and realized still not working. Then I serial-printed the frequency and saw it started at -150 ish (this is the problem), so I printed the sensor reading and realized it starts at 0 (without pressing it) and goes up to 800 ish when pressing. So I changed the sensor reading mapping statements to 0~900 instead of 200~900.
Finally worked!
Analog Output with ServoMotors
Connecting the force sensing resistor to A0 and the servo motor to D3
Programming in Arduino
Result!