We were given the challenge of making a bonic finger from the parts given to us and tailoring the given code to make it work without instructions. But why do we even need prosthetics? Some people aren't as fortunate as us and might have lost an arm or leg in an accident, this leaves them struggling to do things we might take for granted like carrying things or walking.
Here is the needed code, to go into detail watch the video below;
#include (Servo.h)
Servo myservo;
void setup() {
// put your setup code here, to run once:
myservo.attach(9);
pinMode(A0, INPUT_PULLUP);
Serial.begin(9800);
}
void loop() {
// put your main code here, to run repeatedly:
int flexSensor=analogRead(A0);
int angle=(flexSensor-380);
Serial.println(angle);
myservo.write(angle);
}