ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်
ဒီ practice set က new concept မဟုတ်ဘဲ LED wiring, GPIO control, button input concept တွေကို hands-on task ၃ ခုနဲ့ ပြန်ကျင့်သားရအောင် ဒီဇိုင်းလုပ်ထားပါတယ်။
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
Task ၃ ခု — (1) Traffic Light Simulator: LED ၃ လုံး (red, yellow, green) ကို wiring ပြီး Python script ဖြင့် sequence (red→green→yellow→red) auto-cycle ဖြစ်အောင် implement, (2) Button-Controlled LED Brightness: PWM (gpiozero ရဲ့ PWMLED class) ကို သုံးပြီး button press တိုင်း LED brightness level ကို step-by-step တိုးအောင် ရေး, (3) Reaction Time Game: button press + LED ကို ပေါင်းပြီး 'LED light on ချိန်ကနေ button press အထိ ဘယ်လောက်ကြာလဲ' ကို timer ဖြင့် တိုင်းတဲ့ mini-game ရေးပါ။
အတူတူ ကြည့်မယ်
# Task 1 starter — traffic light sequence skeleton
from gpiozero import LED
from time import sleep
red, yellow, green = LED(17), LED(27), LED(22)
while True:
red.on(); sleep(3); red.off()
green.on(); sleep(3); green.off()
yellow.on(); sleep(1); yellow.off()Task ၃ ခုစလုံးအတွက် run-နိုင်တဲ့ Python script/circuit ကို ပြီးမြောက်မည်။၅ မိနစ် စမ်းကြည့်
Task ၃ ခုကို အစဉ်လိုက် ကိုယ်တိုင် implement လုပ်ကြည့်ပါ — LED/wiring resource (ရှိရင်) မရှိရင် code logic ကိုပဲ ရေးကြည့်လည်း learning ရပါတယ်။
သတိလေးတစ်ချက်
Physical LED/circuit မရှိသေးရင်တောင် code logic ကို ကိုယ်တိုင် ရေးကြည့်ပါ — hardware ရောက်ချိန် wiring ပဲ လိုအပ်တော့မှာမို့ code logic ကို ကြိုတင်ကျွမ်းကျင်ထားတာက အချိန်ကုန်သက်သာစေပါတယ်။