Hey guys, just have a short question regarding writing code. I want to build a circuit in which two force-sensitive-sensors generate sound via a piezo, while being pushed.
Now I thought about different states of the piezo.
State 1: No sensor is pushed, piezo produces one tone, delay, same tone again, delay and so on
State 2: sensor1 is pushed: the delay in state 1 gets smaller - is there a quicker way of doing that, instead of writing the same code (e.g. delay(5000), tone(...), delay(4000), tone(...)) ?
State 3: if sensor2 is pushed, I want to create an arpeggio sound, which goes on repeatedly.
State 4: If both sensors are being pushed, I want to create the arpeggio sound and want to speed it up.
Basically I guess I know what I have to do, but I am not sure about the "speed-up-the-tones-thing".. So if there is any hack here, to get this speed up pretty fast it would be nice to know :)
Another question I have:
Those force-sensitive-sensors have different states of resistance, depending on how much I push them. Those signals have to be analog inputs (right?), therefore I have to use digitalread-functions, to get the different values (right?). So if I understand it correctly, I can programm different functions, to different values. Or can declare certain "value-limits" for example every resistance-value below 15 triggers sth. and so on ?
Thanks in advance, if you have any further questions please let me know!