RGB LED Buzzer FLED SW ONOFF LED LED

  • Slides: 17
Download presentation

作品簡介: 彙整所有的專題(RGB LED Buzzer)並統合 在一起選擇控制 FLED SW ON/OFF LED 開關切換 LED Short Fsh. 7

作品簡介: 彙整所有的專題(RGB LED Buzzer)並統合 在一起選擇控制 FLED SW ON/OFF LED 開關切換 LED Short Fsh. 7 LED 短閃 7次 LED long Fsh. 3 LED 長閃 3次 LED Fade ON/OFF LED由暗漸亮又漸暗 RGB Show RYB RGB分別亮紅綠藍 1 GF 3; 2 RF 4; 3 BF 5 1 G短閃 3次; 2 R長閃 4次 3 B短閃 5次; BZ Short Beep 6 蜂鳴器短嗶 6次 BZ Long Beep 3 蜂鳴器長嗶 3次 Traffic. Light 紅綠燈展示

程式設定Setup //====Setup. Buzzer====================== // initialize the digital pin as an output. pin. Mode(buzzer. PIN,

程式設定Setup //====Setup. Buzzer====================== // initialize the digital pin as an output. pin. Mode(buzzer. PIN, OUTPUT); digital. Write(buzzer. PIN, LOW); // turn the BUZZER off by making the voltage LOW //-------Setup-KEY----------------------- // declare KEY 1_PIN,KEY 2_PIN to be an output: pin. Mode(KEY 1, INPUT_PULLUP); pin. Mode(KEY 2, INPUT_PULLUP); � 明: 設定� 位輸出入方式與初始態 KEY 1為輸入 KEY 2為輸入 

硬體電路組裝電路 LED數位輸出-digital. Write() KEY按鍵輸入-digital. Read() LED類比輸出-analog. Write() - PWM Buzzer脈波輸出-tone() 全彩LED流水燈 CN 1 A

硬體電路組裝電路 LED數位輸出-digital. Write() KEY按鍵輸入-digital. Read() LED類比輸出-analog. Write() - PWM Buzzer脈波輸出-tone() 全彩LED流水燈 CN 1 A 0 顯示屏 CN 7 SPI 蜂鳴器 CN 4 -A 3 LED燈光CN 5 -D 3 按鍵輸入 KEY 1, KEY 2 D 2, D 6

選擇控制LED RGB BZ(軟體程式) void loop() { int Bn. State = digital. Read( KEY 2);

選擇控制LED RGB BZ(軟體程式) void loop() { int Bn. State = digital. Read( KEY 2); if(Bn. State==0) { delay(500); // delay in between reads for stability if(Demo. Func>8) Demo. Func=1; else Demo. Func=Demo. Func+1; my. OLED. set. Posi(4, 0); my. OLED. print("Func No=: "); my. OLED. println(Demo. Func); my. OLED. set. Posi(6, 0);

 switch(Demo. Func) { case 1: my. OLED. println("LED SW ON/OFF"); break; case 2:

switch(Demo. Func) { case 1: my. OLED. println("LED SW ON/OFF"); break; case 2: my. OLED. println("LED Short Fsh. 7"); break; case 3: my. OLED. println("LED Long Fsh. 3"); break; case 4: my. OLED. println("LED Fade ON/OFF"); break; case 5: my. OLED. println("RGB Show RYB"); break; case 6: my. OLED. println("1 GF 3; 2 RF 4; 3 BF 5"); break; case 7: my. OLED. println("BZ Short Beep 6"); break; case 8: my. OLED. println("BZ Long Beep 3"); break; case 9: my. OLED. println("Traffic. Light"); break; } }