![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/4d038198dfeabeab6cbc29c2ee55029c.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/40f8bcab836ffcd6b84c4782504f72ef.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/c9c71497a431d53b1dba6b4ad88c3d8f.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/a1fc28a8673ad3b8ca1336927affe897.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/9d1f34edce5e0f60dacbc861ddeb1131.png)
STEP1: Connect push-button module to pin P0 of the expansion board; connect servo to P1.
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/13f6fbd84a9cab5f8e9138b59e4a3744.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/e0ba45b33e155a6aa07722b0b6e5ff30.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/f355212a5e30f0795ac8c9d7c2e6dc2a.png)
STEP2: Programming
1. Drag “set pin P9 servo to…degree” block in “actuator” module. Change P9 to P0. Set pin P0 to control servo’ s value.
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/6534e4a85a2dbd02b5aea96c0e2e6860.png)
2. Set: if the button is pressed, the servo rotates for 100 degree and the LED display “o”. Otherwise, the servo rotates for 0 degree and the LED display “×”. Here we need to use “if…then…else” statement.
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/63738eaff952cad2b06b03f3c5239832.png)
3. Run the program
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/6b3f6f12db569247d46507353829a1fb.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/9ac198739e36b994727f37762e572c31.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/45fd657da69296cfa97ed33f7cd2ec27.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/ac84904cb713a0f85c46afc3be53b7bc.png)
STEP1: Connect the servo to pin P1; connect the motion sensor to pin P0.
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/5924f5021274d2a4f4e5c3f886d452cb.png)
STEP2: Programming
1. Read the digital pin P0 to get the digital signal data of the motion sensor.
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/c2f039a9309cb0f5fef5f9c24d0451b6.png)
2. When the motion sensor detected that there is people passing by, the servo rotates for 100 degrees; otherwise, it rotates 0 degree. We need “if…then…else” statement here.
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/a0e26ce9a2ff2ebe93cb315b12e786ea.png)
3. Run the program:
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/c59713b45b96b4e864827a2e89834824.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/fed9afee2117ade6ee9dc4ab033134bf.png)
![projectImage](https://dfimg.dfrobot.com/6188847caa9508d63a4183aa/makelog/f5a89fca9fdcc0e099a0058d303e8819.png)
![licensBg](/images/license_bg.png)