walle nec servo holder mg995

walle nec servo holder mg995

thingiverse

#include <Servo.h> Servo myservo1, myservo2, myservo3; void setup() { myservo1.attach(3); // attaches the servo on pin 9 to the servo object myservo2.attach(4); // attaches the servo on pin 10 to the servo object myservo3.attach(5); // attaches the servo on pin 11 to the servo object Serial.begin(9600); // sets the serial port to communicate at 9600 bps } void loop() { if(Serial.available()>= 2 ) { unsigned int servopos = Serial.read(); // receives a byte from the serial port unsigned int servopos1 = Serial.read(); // receives another byte from the serial port unsigned int data = (servopos1 *256) + servopos; // combines the two bytes into a single number Serial.println(data); ///////////////////////////////////////////////// if (data >= 1000 && data <1180) //////////////////////////////////////////////// { // int servo1 = data; // gets the value of the first byte servo1 = map(servo1, 1000,1180,1,170); // maps the value to a range between 80 and 170 myservo1.write(servo1); // sets the position of the first servo delay(10); // } ///////////////////////////////////////////////// if (data >=2000 && data <2180) //////////////////////////////////////////////// { // int servo2 = data; // gets the value of the second byte servo2 = map(servo2,2000,2180,1,180); // maps the value to a range between 30 and 120 myservo2.write(servo2); // sets the position of the second servo delay(10); // } ///////////////////////////////////////////////// if (data >=3000 && data < 3180) ///////////////////////////////////////////////// { // int servo3 = data; // gets the value of the third byte servo3 = map(servo3, 3000, 3180,1,180); // maps the value to a range between 80 and 140 myservo3.write(servo3); // sets the position of the third servo delay(10); // } //////////////////////////////////////////////////////// }

Download Model from thingiverse

With this file you will be able to print walle nec servo holder mg995 with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on walle nec servo holder mg995 .