Touch free straw dispenser
thingiverse
Touch free straw thing Code #include <Servo.h> #define trigPin 8 #define echoPin 9 #define powerPin 12 Servo myservo; long duration; float distanceInch; int timer; int dt=200; void setup() { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(powerPin, OUTPUT); Serial.begin(9600); myservo.attach(11); myservo.write(180); digitalWrite(powerPin, HIGH); } void loop() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distanceInch = duration * 0.0133 /2; timer = distanceInch * 10; Serial.println(distanceInch); delay(dt); if(distanceInch<=5.0){ myservo.write(90); delay(500); myservo.write(180); delay(500); } }
With this file you will be able to print Touch free straw dispenser 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 Touch free straw dispenser.