Thuta Learning
ရှာဖွေရန်
ExercisesHardwarebeginner

Practice: GPIO & Circuit Challenges

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Practice: GPIO & Circuit Challenges ကို ကြောက်စရာမလိုအောင် နားလည်မယ်
  • ကိုယ်တိုင် hardware wiring/code ကို run ကြည့်တတ်မယ်
  • Real project ထဲမှာ ဒီ concept ကို ချက်ချင်း အသုံးချတတ်မယ်

ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်

ဒီ 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 ရေးပါ။

အတူတူ ကြည့်မယ်

python
# 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()
You should see
Task ၃ ခုစလုံးအတွက် run-နိုင်တဲ့ Python script/circuit ကို ပြီးမြောက်မည်။

၅ မိနစ် စမ်းကြည့်

Task ၃ ခုကို အစဉ်လိုက် ကိုယ်တိုင် implement လုပ်ကြည့်ပါ — LED/wiring resource (ရှိရင်) မရှိရင် code logic ကိုပဲ ရေးကြည့်လည်း learning ရပါတယ်။

သတိလေးတစ်ချက်

Physical LED/circuit မရှိသေးရင်တောင် code logic ကို ကိုယ်တိုင် ရေးကြည့်ပါ — hardware ရောက်ချိန် wiring ပဲ လိုအပ်တော့မှာမို့ code logic ကို ကြိုတင်ကျွမ်းကျင်ထားတာက အချိန်ကုန်သက်သာစေပါတယ်။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Task 1 မှာ LED ၃ လုံးရဲ့ pin number ကို wiring diagram နဲ့ code ထဲ တူညီအောင် double-check မလုပ်ခြင်း
  • Task 2 မှာ PWMLED ကို LED class အစား သုံးရမှန်း (brightness control အတွက် PWM capability လိုအပ်) မသိခြင်း

အခု ကိုယ်တိုင် စမ်းကြည့်

Task ၃ ခုကို အစဉ်လိုက် ကိုယ်တိုင် implement လုပ်ကြည့်ပါ — LED/wiring resource (ရှိရင်) မရှိရင် code logic ကိုပဲ ရေးကြည့်လည်း learning ရပါတယ်။

You'll know it worked when: Task ၃ ခုစလုံးအတွက် run-နိုင်တဲ့ Python script/circuit ကို ပြီးမြောက်မည်။

Practice: GPIO & Circuit Challenges | Thuta Learning