# Ceaseless # Activable # Trammel --- # 設計構想 ---- * 原型是貓 * 只在你需要某個空間時占用他 ---- #### 運作展示 {%youtube vyUxwXWFFaY %} --- # 內部電路展示 ---- ![IMG_20231211_012003_HDR (1)](https://hackmd.io/_uploads/rJHsnmNLp.jpg) ---- ![IMG_20231211_012111_HDR (1)](https://hackmd.io/_uploads/Hyf33XNU6.jpg) ---- ![IMG_20231211_012153_HDR (1)](https://hackmd.io/_uploads/Bynh3mVLT.jpg) --- # ↓↓原始碼↓↓ ---- ```arduino= #include <Servo.h> Servo myservo; // 創建伺服馬達物件 const int roundTime = 294; int sensorPin = 12; // select the input pin for int servoPin = 9; double sensorValue = 0; void irActiveDelay(int nLoop){ if (digitalRead(sensorPin) == 1){ for(int i = 0; i < nLoop; i++){ if (digitalRead(sensorPin) == 1) i = 0; delay(10); } } return; } void setup() { delay(2000); } void loop() { while(digitalRead(sensorPin) == 0) delay(10); myservo.attach(servoPin); myservo.write(180);//lock delay(roundTime); myservo.detach(); delay(900); irActiveDelay(50);//if nothing approach in 500ms then release myservo.attach(servoPin); myservo.write(0);//unlock delay(roundTime); myservo.detach(); delay(900); } ```
{"title":"Ceaseless Activable Trammel","description":"–","contributors":"[{\"id\":\"12bf46a7-e69f-4d9f-a082-ad99f1da6dd1\",\"add\":1303,\"del\":126}]"}
    161 views