Devices & Components
Arduino Uno Rev3
Jumper wires (generic)
Flex Sensor
Resistor 163K Ω
Software & Tools
Arduino IDE
Project description
Code
Untitled file
arduino
1#include <Servo.h> 2 3Servo m; 4 5void setup() 6{ 7 pinMode(13, OUTPUT); 8 pinMode(A0,INPUT); 9 m.attach(7); 10 Serial.begin(9600); 11} 12 13void loop() 14{ 15 float x=analogRead(A0); 16 float y= ((x-159)/352); 17 18 int angle=(y*180); 19 Serial.println(angle); 20 m.write(angle); 21 22}
Untitled file
arduino
1#include <Servo.h> 2 3Servo m; 4 5void setup() 6{ 7 pinMode(13, OUTPUT); 8 pinMode(A0,INPUT); 9 m.attach(7); 10 Serial.begin(9600); 11} 12 13void loop() 14{ 15 float x=analogRead(A0); 16 float y= ((x-159)/352); 17 18 int angle=(y*180); 19 Serial.println(angle); 20 m.write(angle); 21 22}
Downloadable files
flex_sensor_Lvb7wiwHcg.png
flex_sensor_Lvb7wiwHcg.png

Comments
Only logged in users can leave comments