Welcome to mission control, start the video below to hear the first transmission from the spaceship.
Expanding the possibilities!
In order for different species of the space federation to find you, we will send out the signal using with sound waves as well as light. Lets start by being able to make manual signals. For this to go smoothly the signal that comes in needs to be the same on both outputs. We will make two output parts respond to one sensor. First attach the LED and the Buzzer number 13 en 14. Now attach the distance sensor to port 0.
Can you come up with the code you need to make this work?
Can you make a 3 part splitter? try it and test it!
The splitter you made works all the time, now what if we want to make it work only when a certain condition is met?
To do this we will need another sensor and the IF-block!
Connect a light sensor to port 3 next to the parts you already connected to make the following setup:
Create an IF-statement and drag your previous code inside. Make it respond to the light sensor on port 4. Can you make your code in such a way that the signal only works when it is dark?
Test the code by covering the lightsensor with your hands to make it dark and come closer to the distance sensor. Play around with it, make a nice music light show!
If you look closely at your code you will see a small + icon on the bottom part of the IF-statement. You can use that to add an ELSE-statement. The ELSE-statement will do all the blocks that are in it when the IF-statement is no longer true. Using the else-function, we can reset the signal to 0 every time it is not dark enough.
Can you reset the signal to 0 using the else-part of the IF-function?
Play around with it, make a nice music light show!
Wave of light!
Lets put on a show!
Combining the new code with different hardware, we can now make a waving light which will be visible very well!
Let’s start by adding a servo motor to the output of the Easyboard.
To make the servomotor work perfectly we need to set the width of the Pulse Width Modulation. This sounds hard but it is not, you just add some blocks to the ‘on start’ block, you can see it below.
This code makes sure that the servo will work correctly on all output ports.
Now lets make the splitter go three ways by adding another digital write block.
If you use these components and this code, you can make a waving light by attaching the LED to the servo motor. Make sure the cables don’t get stuck or get a lot of tension on them. You can use the cable extender to make a longer cable for the LED. Show us your creation using the portal below!
Show us your creation!
Be sure you are logged in to receive your space tokens!
Upload a video of your creation and send us the link!