This section introduces several basic projects that can easily be done with HaloCode alone.
1. Make a Volume Detector
Make a volume detector with HaloCode. Use the microphone of HaloCode to detect loudness and visualize the the value with the LED ring. The louder the sound is, the more LEDs will light up.
1) Drag an Events block when HaloCode starts up to the Scripts area.
2) Add a Control block forever.
3) Add a Lighting block LED ring shows ()% and a Sensing block microphone loudness.
4) Click "Upload" to upload the program to HaloCode.
5) Try hitting the table and check the LED ring of HaloCode.
2. Use the Button and Touchpad
The programmable button of HaloCode has plenty of usage scenarios, such as activating a script. The four touchpads of HaloCode can report whether it is being touched via the change in capacitance.
1) Drag an Events block when button is pressed and a Lighting block play LED animation () until done to the Scripts area. Choose LED animation "meteor". When we press the button of HaloCode, the LED animation "meteor" will be played.
2) Add a Control block repeat until () and a Sensing block touchpad () is touched?. Keep the default touchpad0.
3) Click "Upload" to upload the program to HaloCode.
4) Try pressing the button of HaloCode and then touch touchpad0.
3. A Kitten with Blinking Eyes and a Waving Tail
one HaloCode, crocodile clip or wire, one battery box, a pair of scissors, one puncher, one ruler, some cardboard, some double-sided tapes, DuPont wire, 9g servo motor (3.3V).
1) Draw the kitten's body and tail on the cardboard, and then cut them out. Use the puncher to make two holes as the eyes of kitten.
Note: the distance of the two eyes should equal to the greatest distance between two LEDs of HaloCode.
2) Connect the servo motor to HaloCode (any of the four pins will work), as follows:
3) Stick the tail to the servo motor.
4) Connect the body and tail of the kitten with HaloCode, the servo motor, and the battery box, as follows:
Script of Blinking Eyes
5) Drag an Events block when HaloCode starts up and a Control block forever to the Scripts area.
6) Add a Lighting block all the LEDs light up () and a Control block wait () seconds. Set the color to white. We want the kitten to blink eyes randomly, so we need an Operators block pick random () to (), and input number 2 and 6. Add a Lighting block light off all the LEDs and another Control block wait () seconds. Set the time to 0.2 second.
Script of the Waving Tail
7) Drag an Events block when HaloCode starts up and a Control block forever to the Scripts area.
8) Add a Pins block servo pin () rotates to () and a Control block wait () seconds. Set the degree to 0 and keep the default time.
9) Add another Pins block servo pin () rotates to () and Control block wait () seconds. Both keep the default value.
10) Click "Upload" to upload the program to HaloCode.
11) Check the kitten! Is it blinking eyes and waving its tail at the same time?