This lab took two tries. Here is the first attempt, which produced no reaction from the servomotor:
I believe I had the range incorrectly mapped. I needed to adjust 1023, the upper range in the example, to 1000, the true maximum measurement of force detected by my FSR. I’m blogging this late so unfortunately I can’t remember the problem exactly, but I think it was because of 1023 being the incorrect upper end of the range. I asked David for help and he explained to me that an imprecise mapping could throw off communication between the serial and the Arduino.
I set up the lab again a few days later, first detecting the sensor’s range and printing it to the serial monitor. Again I got about 0 to 1000.
The code:
And now the servomotor functions properly.
Very excited to see where I can go with motors. I imagine sculptural and robotic possibilities are endless. Also, I would like to get the servomotors turning 360° continuously, creating rotation in whatever they are attached to.
Leave a Reply