Hi there! Today we are going to explore how we write software to control real-world physical devices like robots.
Physical computing connects the digital world of coding to the physical world around us. We use a design process to build systems that sense the environment and react by moving, lighting up, or making sound.

To solve an everyday problem, like an automatic nightlight, we design a program using a sequence of steps. We use an 'event' like a dark room to trigger our code, and a 'conditional' statement to decide when to turn the light on.
We can write these instructions using visual block-based languages or text-based languages like Python. Loops allow our robot to constantly repeat actions, like checking a distance sensor so it never crashes into a wall.
Use the engineering design process to program a smart plant watering system that waters a plant only when the soil is dry.
- 1. Identify the Problem: Plants wither if they dry out, but manual watering is easy to forget.
- 2. Plan the Solution: We need a soil moisture sensor (input), a water pump (output), and a microcontroller to run our code.
- 3. Write the Logic: Create a loop that constantly reads the moisture level. Use a conditional block: 'If moisture is less than 30%, turn on pump; else, turn off pump.'
- 4. Build and Test: Connect the real hardware, upload the program, and test it in dry soil to ensure the pump activates correctly.
