/*
🍄 MISSION: PROGRAMMING THE ORELLANA FARM COBOT
Instructions for students: Read the code carefully. Copy the questions and write your answers in your notebook (cuaderno).
1. The Decision Maker
To automate the Orellana farm, the Cobot needs to make choices.
Look at Step 6 in the code. Which two keywords allow the Cobot to choose between two different actions?
Answer in your notebook: The two words are ________ and ________.
2. Protecting the Mushrooms
The Cobot uses the HC-SR04 sensor to detect if a harvest basket or a person is too close to the Orellana bags.
If the sensor detects an object at 10 cm, what happens to the LED? (ON or OFF?)
Why is this "Alarm" important for a mushroom farm?
3. Translate the Code
Translate these technical instructions into simple Spanish for the farm workers:
if (distancia < 15)-> ________________________________digitalWrite(PIN_LED_INTERNO, HIGH);-> ________________________________else-> ________________________________
4. Code Detective: Brackets { }
In C++, we use "Curly Brackets" { } to group the Cobot's actions.
Look at the code. What symbols do we use to "open" and "close" the actions of the
ifand theelse?What happens if you forget to close a bracket in the Arduino IDE?
5. Adjusting the Sensor
The Orellana bags are growing! now you need more space. You want the Cobot to alert you only when something is closer than 25 cm.
Write the new line of code for this change in your notebook:
New code:
if (distancia < ____ )
6. WOKWI CHALLENGE: THE FARM SAFETY SYSTEM 🛠️
Build the Orellana protection circuit in
The Controller: Add an ESP32 DevKit V1.
The Sensor: Connect Trig to Pin 5 and Echo to Pin 18.
The Alarm: Connect an LED to Pin 2.
The Goal: Run the simulation. The LED must turn ON only when the distance is less than 15 cm.
| Sensor HC-SR04 | ESP32 (Pin) | Color de cable sugerido |
| VCC | 5V o VIN | Rojo (Energía) |
| Trig | D5 | Verde (Señal) |
| Echo | D18 | Amarillo (Eco) |
| GND | GND | Negro (Tierra) |
No hay comentarios:
Publicar un comentario