Skip to content
[繁]

Computational Thinking × Vibe Coding ​

Example: Use an ultrasonic sensor with an ESP32 to measure distance and show it on an OLED display.

🧭 0. Project Overview: The Big Picture ​

Before you start, answer these questions:

  1. What real-world problem should the system solve—for example, measuring distance, avoiding obstacles or issuing a warning?
  2. How would you describe the complete process in one sentence—for example, “sense distance → decide → display or warn”?
  3. What broad modules will the system need? Think about sensing, display and decision-making.
  4. What input does each module require, and what output does it produce?
  5. How should a successful system behave in terms of update speed, accuracy and error handling?

🔧 1. Subsystem A: Ultrasonic Distance Measurement ​

1.1 Guided Design Questions: Sensor PRD ​

Guiding questionYour thoughts
1️⃣ What is the sensor module's principal purpose?
2️⃣ What input does the sensor need and what output does it produce? Consider its Trigger and Echo pins.
3️⃣ How will you control the measurement frequency without blocking the program with delay()?
4️⃣ How will you reduce noise—for example, by averaging several readings?
5️⃣ What requirements must a stable and accurate system meet, such as an error range or update rate?
6️⃣ How should the system respond when there is no echo and a measurement fails?

1.2 Structured Prompt for the AI ​

Think through the questions above and write your own prompt first.

Answer: generated with Gemini

🖥️ 2. Subsystem B: OLED Display ​

2.1 Guided Design Questions ​

Guiding questionYour thoughts
1️⃣ What should the OLED show: distance, warnings, error messages or something else?
2️⃣ How quickly should it update? Use millis() rather than delay().
3️⃣ What should it display while new data is unavailable?
4️⃣ How will you control the refresh rate and prevent flicker?
5️⃣ Which OLED library will you use, and how will you confirm compatibility?
6️⃣ How many states should it display—for example, normal, warning and no data?

2.2 Structured Prompt ​

Think through the questions above and write your own prompt first.

  • If you continue in the same AI conversation, you do not need to repeat “You are an embedded-systems engineer” or “Generate a program for ESP32 using the Arduino core.” Instead, tell the AI to test the OLED display module independently.
  • When the AI gets something right, say so. Positive feedback helps it recognise the expected kind of answer later in the conversation.
  • Verify the ESP32 I²C pins carefully. Older AI tools are especially prone to hallucinating them.
  • The generated program subsequently had two problems that I asked the AI to correct and also fixed manually:
    • The Adafruit SSD1306 library does not support Chinese text.
    • The text was too large and wrapped onto another line.

Answer: generated with Gemini

⚙️ 3. System Integration: Main Program ​

3.1 Guided Design Questions ​

Guiding questionYour thoughts
1️⃣ How should data flow between the sensor and display modules?
2️⃣ In what order should the main program run them?
3️⃣ How will you update the distance every 200 ms?
4️⃣ What should happen when an object is too close?
5️⃣ Where should you leave extension points for additions such as a buzzer?

3.2 Structured Prompt for the Integrated Main File ​

Think through the questions above and write your own prompt first.

Answer: generated with Gemini

4. Creative Extension ​

💡 Move from “the function works” to “a meaningful application.” Use computational thinking—decomposition, abstraction and algorithms to turn the original function into a real-world application. This is a bonus task combining creativity and logic. It does not need to be complicated; it needs a clear connection and genuine value.

4.1 Challenge ​

Your ESP32 system can now display distance reliably. How could you extend it into a prototype with a real purpose?

Computational-thinking skillGuiding questionExample
🧩 DecompositionWhich modules make up the system, and which could be improved?Sensor, display, warning and data-logging modules
🪄 AbstractionWhich core function should be extracted for a particular setting?“Distance warning” becomes “safe-distance detection”
🔁 Algorithmic thinkingIs the trigger → decision → feedback data flow clear?Ultrasonic sensor → distance → condition → display → buzzer/feedback

4.2 Example Ideas ​

LevelConceptCharacteristic
⚙️ Level 2: beginnerLight a warning LED when an object is too closeA technical extension without a defined setting
✅ Level 3: competentUltrasonic sensor + OLED as a rangefinder or obstacle-avoiding vehicleA specific purpose with a describable process
💬 Level 4: proficientA cane for a blind user with ultrasonic sensing, buzzer and vibrationConnected to a user need, with a feedback loop
🧠 Level 5: expertA smart navigation cane with AI obstacle recognition and distance-based sound

4.3 Creative Extension Submission Guide ​

💡 Move from “completed function” to “creative application.” Present your idea in five short sections of two to four sentences each. You may include a hand-drawn sketch, Mermaid flowchart or AI-generated concept image.


🧭 1. Application Scenario ​

Explain the setting and subject of your application.

Examples: an obstacle-avoiding cane, a smart bin that detects its fill level, or a doorbell with distance warning.

✅ Key point: use a real setting and a clear functional purpose.


🙋‍♂️ 2. User Needs ​

Who will use it? What problem do they face, and how will your system help?

Example: a blind pedestrian cannot easily judge the distance to an obstacle → provide ultrasonic sensing and buzzer feedback.

✅ Key point: connect a user's problem to a corresponding solution.


🔌 3. New I/O Design ​

Describe any additional sensors or output devices.

Examples: a buzzer, vibration motor, spoken output or Wi-Fi upload.

✅ Key point: identify each new input or output and its purpose.


🔁 4. Flowchart or Concept Sketch ​

Draw or briefly describe the complete operating sequence.

Example: ultrasonic sensor → distance decision → buzzer/vibration feedback → display.

✅ Key point: show the input → processing → output/feedback logic clearly. Mermaid, a hand drawing or a simple diagram are all acceptable.


🌍 5. Social Value or Extension Potential ​

How does the design benefit society? Could it develop into a product or research project?

Examples: improve accessibility or extend the idea into a smart-city sensor network.

✅ Key point: connect the design to people, society or the environment and suggest a future direction.

💡 Levels of Creative Thinking ​

⚙️ Lower-level creativity: technology-driven
Start with a technology and look for a use.
Example: an ultrasonic sensor and display suggest an obstacle-detecting cane.

🧭 Higher-level creativity: user-driven
Start by observing a user and their problem, then design suitable technology.
Example: a visually impaired person cannot judge obstacle distance, so you select ultrasonic sensing and spoken feedback.

✅ Key point:

Technology is only a tool. Creativity should begin with people and their needs. Higher-level concepts are normally more feasible and socially valuable.

5. Worksheets and Assessment ​

  1. Computational Thinking × Vibe Coding worksheet (complete and submit electronically)
  2. 🧮 AI-assisted programming rubric: Vibe Coding × Computational Thinking
  3. AI-assisted programming reflection and self-check form (complete and submit on paper)

Translation notice: This English page was generated automatically by AI and has not yet been reviewed by a human. It will be checked and revised page by page when time permits.

Last updated: