Lesson 2 - Grow Light Control
Students learn how to use a variable to control the brightness of a grow light strip.
I can explain what a variable is and how it stores data.
I can use the UNIHIKER K10 buttons to increase and decrease the variable value.
I can explain why the light period matters for plant growth.
1. Engage: What if Indoor Plants Don’t Get Enough Light?
Plants on a windowsill or in a classroom corner often look weak—pale leaves, slow growth, stems stretching toward the window.

Key Question
What happens to indoor plants when they don’t get enough light?
Hydroponic plants are usually grown indoors, so they lack sufficient light. We need an “artificial sun” that gives plants the light they need, whenever they need it.
Let’s build a smart grow light with our UNIHIKER K10 and let the students be the “light keepers” for their plants!
2. Explore: How Does the Light Strip Work?
Show students the full-spectrum grow light strip and connect it to the building block expansion board.

Then insert the UNIHIKER K10 into the expansion board

Open Mind+ and connect the UNIHIKER K10.
![]()
Build the program and upload.

![]()
After downloading, the grow light strip lights up.
Key Question
Is the light bright or dim? What color does it look?
Tell students: The brightness of the LED strip is controlled by the analog write block. You can output an analog signal to the corresponding pin. For the LED strip, the higher the signal value, the brighter the LEDs.
Teacher NOTE:
The analog write block does not generate a true analog voltage. Instead, it relies on PWM (Pulse Width Modulation) to rapidly toggle a digital pin on and off. Adjusting the proportion of time the LED remains illuminated in each cycle alters the average current, which in turn controls brightness.
If you have any questions about programming for Mind+, please visit this website (https://mindplus.dfrobot.com/mp2/3Coding/32UploadMode/) for a quick start of Mind+.
3. Engineer: Control Brightness with a Variable
This section is demonstrated by the teacher. Students watch and discuss; they do not program yet. The goal is to introduce the concept of a variable.
Show students how to create a variable called brightness to remember a number.
Create the variable:


Build the program and download.

Now change the variable value to 255, 512, 1023 and download each time so students can watch the strip get dimmer and brighter.
Explain that a variable is a named place in the program that stores data. By storing the brightness number in a variable, we can change one value, and the light follows.
Key Question
How can we change the variable without rewriting the program?
4. Experience & Challenge: Adjust Brightness with Buttons
Experience: Use Buttons to Change the Variable
Activity 1
• Rebuild the code in Mind+.

• Download the UNIHIKER K10 and test:
• ✅ Press button A several times → the grow light gets dimmer
• ✅ Press button B several times → the grow light gets brighter
Our light now responds to buttons—but we cannot see the level at a glance.
Key Question
How can we show the current brightness level on the UNIHIKER K10 screen?
Challenge: Show the Brightness Level on the Screen
Activity 2
• Encourage students to design their own display on the UNIHIKER K10 screen—as long as it shows the level changing with the buttons. For example:
• • Show a number from 0 to 1023 to represent the brightness level.
• • Draw a color bar that grows with brightness.
• • Change the screen background color, from dark at low brightness to bright at high brightness.
• • Or get creative: a sun/moon icon, an emoji, a plant that “grows” as it gets brighter, etc.
• Encourage students to explain their design to the class.
Teacher Note:
A perfect way is to use a draw rectangle of brightness up to 1023 on the screen.

5. Elaborate: Why Do Plants Need Light—and Darkness?

Key Question
Why are there so many lights on at night on this dragon fruit farm? Can you guess?
Reveal the answer: dragon fruit is a long-day plant. It needs a long period of light to flower and set fruit, so farmers add light at night to extend its “daytime.”
Just like animals, plants need a rhythm of light and dark. The length of day and night—called the photoperiod—tells plants when to grow, flower, or rest.
Activity 3
• Ask students to research the light needs of three different plants.
Connect back to our project:
A smart hydroponic system can use a timer or a light sensor to give each plant the right amount of light—exactly what we are building toward.









