Let's make a strong wind indicator, which can change color according to the strength of the wind.
Suitable kits: mCookie302, IBC
- USB cable*1
- Sensor cable*2
- Sensor shell*1
- Lego or other fixation structure
Learn about the New Sensors
Sensor-Mic can convert the volume of external sound into the strength of electric signal. The bigger the external sound is, the stronger the electric signal is.
- Assemble the modules and sensors:
- Stick the red core module, battery base and green extension module together;
- Connect the color LED wire to pin 6/7 of Hub;
- Connect the Mic sensor to pin 4/5 of Hub;
- Insert one end of USB cable into the battery base, and connect the other to computer;
Required Program Blocks
If the Mic sensor has detected the sound, the color LED changes into red, representing dangerous; if the Mic sensor hasn't detected sound, the color LED changes green, representing safe.
If there is sound detected, the color LED changes into red, otherwise, it changes into green.
ColorLED prepare, set the color number to 1, and the control pin to 6;
Drag the "if-else" program block, and set the condition of "if" to that the Mic sensor has sound, in this way, LED 1 changes into red, "else", it changes into green.
Test the result
After upload, if you "blow" or "cry" to the microphone, the color LED will change into red; under static state, the microphone can't detect sound, the color LED will change into green.
- Product number of Mic sensor: MSDI11
- Analog sensor.
- For details, please refer to Sensor-MIC
- Q: Is the Mic sensor a digital signal sensor? Can it only be connected to digital port?
- A: The Mic sensor is analog sensor, and it can convert the strength of the sound into that of the electric signal of which the range is 0-5V. If connected t digital port and the converted voltage is larger than 2.5V(strong sound), the range is 1(true), otherwise(weak sound), it is 0(false).