Function of the Module
- Please refer to: Microduino-Shake
- As a digital input sensor, it can only detect "0" and "1", meaning "Yes" and "No".
Overview
To use the Shake sensor to detect if there is vibration and print monitored data in the serial monitor.
Bill of Material
Hardware Buildup
- Setup 1:Connect the interface of the Shake with the digital port (10) of the Hub. Accessible Hub pins: 0,2,4,6,8,10 and 12.
- Setup 2:Connect the CoreUSB, Hub and Shake sensor to the computer with a USB cable.
Mixly Programming
- Step1:Since using serial monitor, we need to find "Serial Communication" from "Communication" item.
- Step2:"Serial Communication" description.
- Step3:The Shake sensor is an input device while the returned data is digital quantity, based on which we can find and drag out the digital input and output from "Input/Output".
- "Digital Input" description.
- Overall code description.
Debugging
- Step1:Select the right board card(Core USB 32U4) and COM port(Recognized automatically by default).
- Step2:Open the serial monitor.
- Step3:To see if the serial baud rate is the same with the pre-set one.
- Step4:Observe the data, which is "0" when no vibration happens and is "1" when there is a vibration. You can also see the indicator blink when there is a vibration.
|