Intruder Alert! ...Or, Welcome?
The mindsensors Grove Sensor Adapter makes it easy to use a variety of unique Grove sensors with the EV3. Our custom block makes it easy to read the sensor from your program. Here is an example of using it with the Grove motion sensor.
The Grove motion sensor is a very cool device with a wide range of applications. You can use it to trigger an intruder alert! Or you could have a robot say "hi" and wave when it sees someone. We'll take the more friendly approach today.
To start off this project our robot is simply a mount for the EV3 with the Grove Sensor Adapter connected to port 1, and the PIR Motion Sensor connected to that. Here is a simple program that will play a sound when it sees someone.
To make things more interesting, we can add a Display block to show our helpful fairy friend on-screen. With just one more block we could also light an LED when someone is detected, using another Grove Sensor Adapter and the LED Socket Kit.
A bit more will let us add an animation to show the character flapping up and down. Here we add a loop that runs alongside the sounds. The loop will draw the image with a y of -3, wait half a second, then do the same with y = 3. Because the Clean Screen input is set to True, the image will appear to bob up and down. At the same time, the sounds will play, then wait an additional three seconds. Once that finishes we use a Loop Interrupt block. Notice how the animation loop is set to run Unlimited? Three seconds after the sounds play, this will stop the loop. You can name loops by clicking the "01" label at the top. Finally, the screen will be reset once the animation finishes.
We hope you enjoyed this idea for a project. There are so many more robots possible with the Grove PIR Motion Sensor and mindsensors.com Grove Sensor Adapter. Look at the main blog page to contact us and submit your own project!