Case 12 - Energy-Conserving RGB LED Indicator
Part 1 Objective
Write a program for Codey to achieve the following effects. In the daytime, the RGB LED indicator does not light up whatever the ambient sound loudness is. At night, the RGB LED indicator lights up when the ambient sound becomes louder and it goes off when the ambient sound becomes lower. You can shade the light sensor to simulate night and expose the light sensor to simulate daytime.
Part 2 Preparation
Codey (robot controller) x 1
USB cable x 1
Computer with network access x 1
Connect Codey to the computer by using the USB cable, open mBlock 5 (PC client, web version, or mobile app), delete the default device, click +add, select Codey from Device Library and then click Set as mostly used device in the upper left corner, click Connect, and select the Upload mode.
Part 3 Programming
Use Looks blocks and the ambient light intensity block in Sensing blocks together with the blocks used for programming the voice-activated RGB LED indicator in Case 11, and click Upload to achieve the following effects. In the daytime, the RGB LED indicator does not light up. At night, the RGB LED indicator lights up and goes off based on the sound loudness.
Part 4 Practice
Try to program the brightness level of the RGB LED indicator on Codey to change with the darkness level. In dim light, the RGB LED indicator is lit up at a low brightness; and in darkness, it is lit up at a high brightness.