I’ve built a sensory extension helmet equipped with human scale cat whiskers that when flexed triggers a vibrating motor disc (additionally, the motor intensity is proportional to the bend angle magnitude). The whiskers utilize 4" unidirectional flex/bend sensors to track resistance change upon contact with an object.
The code (attached) I’m currently using works fine with regard to conversion to resistance, re-mapping to bend angle, and re-re-mapping to a vibration motor output. I have a major problem though…the base resistance of the flex sensor changes quite frequently and the code-as-written doesn’t take this fluctuation into account. Every time I boot up the helmet I have to set/calibrate “STRAIGHT_RESISTANCE” and “BEND_RESISTANCE” values. More problematic is that, once the whiskers are bent a few times, the new actual baseline resistance value is different than the original “STRAIGHT_RESISTANCE” value.
I need help figuring out how to alter the code to take this into account. It seems apt to call this sort of function continuous self-calibration. To note: I’m relatively new to programming, so please keep that in mind. Any assistance would be greatly appreciated!
Flex_Sensor_Tactile_Display_Combined.ino (2.28 KB)