We added a cardboard rib to the top of the mask in order to hold and mount the servo. For this version, we also added the motion of the servo to the mask. So far, the mask opens when a push button is pressed and held. The mask remains closed if the button is unpressed.
Mask Motion and Build
Code
#include <Servo.h> const int SWITCH_PIN = 2; const int SERVO_PIN = 9; Servo svo; void setup() { Serial.begin(115200); pinMode(SWITCH_PIN, INPUT); svo.attach(SERVO_PIN); } void loop() { if (digitalRead(SWITCH_PIN) == HIGH){ svo.write(180); } else if (digitalRead(SWITCH_PIN) == LOW){ svo.write(0); } }
Leave a Reply
You must be logged in to post a comment.