# Case 05: Automatic Lamp ## Purpose --- - Programme to turn on the lights automatically in the darkness. ## Material --- - 1 x [TPBot](https://shop.elecfreaks.com/products/elecfreaks-micro-bit-tpbot-car-kit-without-micro-bit-board?_pos=1&_sid=f32828112&_ss=r) ![](./images/TPBot_tianpeng_case_01_01.png) ## Software --- [MicroSoftmakecode](https://makecode.microbit.org/#) ## Programming --- - Click "Advanced" to see more choices in the MakeCode drawer. ![](./images/TPBot_tianpeng_case_01_02.png) - We need to add a package for programming. Click "Extensions" in the bottom of the drawer and search with "tpbot" in the dialogue box to download it. ![](./images/TPBot_tianpeng_case_01_03.png) ### Sample - Set to move forward at the speed of 100%. - Judge if the current light intensity is below the set point, if yes, set the headlights in white; or in black. ![](./images/TPBot_tianpeng_case_05_04.png) ### Link - Link: [https://makecode.microbit.org/_4Wm85b3K4ikU](https://makecode.microbit.org/_4Wm85b3K4ikU) - You may also download it directly below:
### Conclusion - Power up to set the TPBot driving forward and turning on/off the headlights automatically while it goes into the dark/bright area. ## Exploration --- ## FAQ --- ## Relevant File ---