Figure 1
From: In vivo closed-loop control of a locust’s leg using nerve stimulation

Scheme of the implemented control loop. The angle set point is selected and the measured leg angle subtracted from it to conform the error signal, which is sampled by the microcontroller. A proportional control algorithm runs in the microcontroller, varying the period of the stimulus signal applied on the nerve. The leg angle is sensed with a flexible resistor to provide the feedback.