Arduino Night Light
this is a very thing to do. You can use it as a tool to help you lights up at night.
Material
材料:
紙
盒子
led燈
傳輸線
220歐姆
連接線
麵包版
用具:
繪畫用具
剪刀
黏貼用具
Circuit
just use three LED and three ome and also three lines to connect.
Program
int yellow = 9;
int green = 8;
void setup() {
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
}
void loop(){
changeLights();
delay(5000);
}
void changeLights(){
// green off, yellow on for 3 seconds //
digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);
delay(3000);
// turn off yellow, then turn red on for 5 seconds //
digitalWrite(yellow, LOW);
digitalWrite(red, HIGH);
delay(5000);
// red and yellow on for 5 seconds (red is already on though)
digitalWrite(yellow, HIGH);
delay(2000);
// turn off red and yellow, then turn on all digitalWrite(yellow, HIGH);
digitalWrite(red, HIGH);
digitalWrite(green, HIGH);
delay(3000); }
外觀
分別有兩個重點
一個是要開洞給燈
第二是要開洞讓傳輸線可以穿過去
美化
可以再箱子上用你喜歡的繪畫用具幫你的箱子做裝飾,畫上你喜歡的圖案,使他看起來更美觀一點
成品
這樣就完成了,這個作品是很簡單的,就算你是初學者也可以試著做做看