Approved content

The content below is provided by a partner.

dexterind/pxt-giggle 2.0.3 GitHub

GiggleBot by Dexter Industries

This library provides blocks to control the Gigglebot, its motors, neopixels, sensors and servos. For more information: https://www.gigglebot.io/pages/program-the-gigglebot-robot

Example Usage

Displaying a smile

To display a big red smile:

lights.smileShow(NeoPixelColors.Red)

Displaying a rainbow smile

Because everyone loves rainbows, the Gigglebot can smile at you in rainbow colors. It’s so happy it’s giggling in colors!

lights.smileRainbow()

Cycling through the colors of the rainbow

You can cycle through the colors of the rainbow if you want a dazzling smile! This block will cycle through the colors three times.

lights.smileCycleRainbow(3)

Control that rainbow

You can control how the colors get cycled through, how long each color gets displayed, and how long the whole cycle lasts.

lights.smileCycleRainbowTime(100, 3000)

Use the smile to display a value

You can use the smile to display a value visually. For example, the Gigglebot can give you an idea of how far it is from an object. The below code will show a full smile if there is no obstacle within a meter. Then leds will turn off one by one as the Gigglebot gets closer to the obstacle.

basic.forever(() => {
    lights.smileShowGraph(gigglebot.distanceSensorReadRangeContinuous(), 1000)
})

Control the NeoPixels eyes

You can choose to change the eye colors to your heart content by using the Neopixels blocks. This variable block will allow you to decide which eye. This will turn both eyes to green.

lights.whichEye(gigglebotWhichEye.Both).showColor(neopixel.colors(NeoPixelColors.Green))

More control over the NeoPixels smile

You can use the Neopixel blocks to control the smile. The following code would turn the lights off.

lights.smile().clear()

To use a second micro:bit as a remote control

This is a quick and rewarding project! You can control your Gigglebot by using a second microbit. You will need to have :

On the remote micro:bit

Use a second micro:bit as a remote control for your Gigglebot. Moving the remote hand-held microbit will control the Gigglebot. On this micro:bit, put the following code: (note that the group number must be the same between remote and GiggleBot, and each pair must have a unique number)

remote.setGroup(1)
basic.forever(function () {
    remote.remoteControl()
})

On your gigglebot’s microbit

use the following blocks

On the gigglebot’s micro:bit, put this code: (note that the group number must be the same between remote and GiggleBot, and each pair must have a unique number)

remote.setGroup(1)
remote.onRemoteControl(function () {
    remote.remoteControlAction()
})

Supported targets

License

MIT License

Copyright 2018 Dexter Industries

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

giggle=github:dexterind/pxt-giggle#v2.0.3