Applications of Programming in Real Life現實生活中的程式應用
A bilingual study page for input-output devices, programmable microcontrollers, event-driven programs, automation, IoT, AI, speech recognition, and smart living.
本雙語學習頁涵蓋輸入輸出裝置、可編程微控制器、事件驅動程式、自動化、物聯網、人工智能、語音識別與智能生活。
Learning Objectives學習目標
Use programming modules and libraries to interact with physical objects, write event-driven programs, and understand simple AI functions through real-life cases.
運用程式模組與程式庫和實體物件互動,編寫事件驅動程式,並透過生活例子理解簡單人工智能功能。
Study Path學習路線
Start from hardware devices, connect them to microcontrollers, then design conditional and event-driven programs.
由硬件裝置開始,連接到微控制器,再設計條件式及事件驅動程式。
Learning Modules學習模組
Core Concepts核心概念
Maker culture, STEAM, IPO cycle, and real-life programming.
創客文化、STEAM、輸入—處理—輸出周期及生活程式應用。
Input and Output輸入與輸出
Sensors, manual inputs, LEDs, buzzers, displays, and motors.
感應器、手動輸入、LED、蜂鳴器、顯示器及摩打。
Microcontrollers微控制器
micro:bit, setup, forever loops, pins, and event handlers.
micro:bit、設定、無限循環、接腳及事件處理器。
Automation自動化
Conditional logic for smart street lights, homes, and appliances.
以條件邏輯控制智能街燈、智能家居及電器。
IoT, AI and Speech物聯網、AI與語音
AIoT, big data, cloud computing, image and speech recognition.
AIoT、大數據、雲端運算、圖像識別及語音識別。
Practice練習
Auto-scored quiz, 3D flashcards, and exam-style questions.
自動評分測驗、3D閃卡及考試式題目。
Core Concepts核心概念
Maker Culture創客文化
Maker culture encourages people to solve problems through DIY: creating or adapting products with robots, sensors, electronics, and 3D printing.
創客文化鼓勵人們透過DIY解決問題:利用機械人、感應器、電子元件及3D打印創造或改良產品。
STEAM
STEAM integrates Science, Technology, Engineering, Art and Mathematics. Hands-on experimentation is central to solving real-life problems.
STEAM融合科學、科技、工程、藝術及數學。動手實驗是解決現實問題的核心。
Input-Process-Output Cycle輸入—處理—輸出周期
Input and Output Devices輸入與輸出裝置
| Device裝置 | Measures / Outputs量度/輸出 | Applications應用 |
|---|---|---|
| Light sensor | 光感應器 | Light intensity光線強度 | Automatic lighting and smart street lights自動照明及智能街燈 |
| Ultrasonic sensor | 超聲波感應器 | Distance by ultrasonic waves利用超聲波量度距離 | Automatic taps, parking sensors, obstacle avoidance自動水龍頭、泊車感應、防撞 |
| Temperature and humidity sensor | 溫濕度感應器 | Air temperature and humidity空氣溫度及濕度 | Air-conditioners and smart greenhouses冷氣機及智能溫室 |
| PIR motion sensor | 被動紅外線動作感應器 | Human movement by infrared radiation透過紅外線偵測人體動作 | Automatic doors and escalators自動門及自動扶手電梯 |
| Accelerometer / Gyroscope | 加速度計/陀螺儀 | Acceleration and direction加速度及方向 | Pedometers and drone balancing計步器及無人機平衡 |
| LED / Buzzer / Display / Motors | LED/蜂鳴器/顯示器/摩打 | Light, sound, information, motion光、聲音、資訊、動作 | Indicators, alarms, dashboards, fans, robotic arms指示燈、警報、儀表板、風扇、機械臂 |
Manual Input Devices手動輸入裝置
Buttons, joysticks, slide potentiometers, and rotary potentiometers require users to adjust or enter data by hand.
按鈕、操縱桿、滑動電位器及旋轉電位器需要用戶以人手調校或輸入數據。
Output Device Choice輸出裝置選擇
Choose displays for values, LEDs for visual signals, buzzers for alarms, DC motors for continuous rotation, and servo motors for positioning.
顯示數值用顯示器,視覺訊號用LED,警報用蜂鳴器,連續旋轉用直流摩打,定位角度用伺服摩打。
Programmable Microcontrollers可編程微控制器
A programmable microcontroller is the main processor of an electronic device. It processes data and controls connected input and output devices according to uploaded program instructions.
可編程微控制器是電子裝置的主要處理器,會根據已上載程式的指令處理數據,並控制連接的輸入及輸出裝置。
Forever Loops無限循環
Electronic devices often repeat tasks continuously. In micro:bit, setup code runs once after start, while forever-loop code repeats until reset or power off.
電子裝置經常需要不斷重複工作。在micro:bit中,設定程式只在啟動後執行一次,而無限循環程式會一直重複,直至重設或關機。
on start: show number 3 show number 2 show number 1 forever: show icon HEART show icon SMALL_HEART
Event-Driven Programming事件驅動程式
The program waits for a specified event, such as a button press or sensor change. When the event occurs, the corresponding code is executed.
程式等待指定事件,例如按下按鈕或感應器數值改變。事件發生時,對應程式碼便會執行。
when button A is pressed: show string "A" when button B is pressed: show string "B" when buttons A+B are pressed: clear screen
Automation and Smart Living自動化與智能生活
Automation lets a computer make decisions according to a preset program. Automated devices can reduce manual work, increase cost-effectiveness, and operate continuously.
自動化讓電腦根據預設程式自行作出決定。自動化裝置能減少人手工作、提高成本效益,並可持續運作。
Smart Street Light Algorithm智能街燈演算法
forever:
read light sensor value
if brightness < threshold:
turn on the LED
else:
turn off the LED
The smaller the light sensor reading, the darker the environment. A threshold such as 100 can separate dark and bright conditions.
光感應器讀數越小,環境越暗。可使用例如100的臨界值分辨黑暗與明亮環境。
Smart Home Examples智能家居例子
Smart lamps adjust brightness, smart air-conditioners react to temperature and presence, smart locks use smartphone or biometric recognition, and smart gardens irrigate automatically.
智能燈會自動調校亮度;智能冷氣會根據溫度及人在家與否調節;智能門鎖可使用手機或生物識別;智能花園可自動灌溉。
Design Thinking Link工程設計思維
Ask, imagine, plan, create, and improve. This mirrors the programming process: define the problem, analyse it, design the algorithm, develop the program, then test and debug.
提問、想像、計劃、創作、改良。這與程式解難流程相似:定義問題、分析問題、設計演算法、開發程式、測試及除錯。
IoT, AI and Smart Living物聯網、人工智能與智能生活
Internet of Things物聯網
IoT is a network of objects connected to sensors and the Internet, allowing data transfer and updated information collection.
物聯網是把物件連接到感應器及互聯網的網絡,讓物件傳送數據並收集最新資訊。
Wi-Fi, Bluetooth, RFID, NFC
AIoT人工智能物聯網
AIoT combines AI, big data and IoT. Collected data is analysed and used to predict outcomes or make automatic decisions.
AIoT結合人工智能、大數據及物聯網。系統會分析收集得來的數據,預測結果或作出自動決策。
Image Recognition圖像識別
An AI model can be trained with image samples, then tested with new photos. Cloud computing may provide the required processing power.
AI模型可使用圖像樣本訓練,再用新相片測試。雲端運算可提供訓練模型所需的運算能力。
Speech Recognition語音識別
Speech recognition converts human speech into text. Apps can analyse the recognised text and trigger actions, such as displaying the result or controlling devices.
語音識別把人類語音轉換成文字。應用程式可分析識別結果並觸發動作,例如顯示文字或控制裝置。
Interactive Quiz互動測驗
Answer all questions, then submit for instant feedback.
完成所有題目後提交,即時查看評分與解析。
3D Flashcards3D閃卡
Click a card to flip it. Use these for quick concept review.
點擊卡片翻轉,用作快速溫習核心概念。
Exam-Style Questions考試式題目
Filter by difficulty. For open-ended items, use the reference answer button to reveal marking points.
可按難度篩選。開放式題目可按「查看參考答案」顯示評分要點。