Hardware Library

Sphero/Ollie

{"func":"blockSpheroSetSpeed"}

Set Speed

Use "Set Speed" to set Sphero/Ollie to the specified speed.

Parameters:

Speed: percentage speed

Related Blocks:
{"func":"valueSpheroSpeed"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"wrapper","func":"valueSpheroSpeed"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueSpheroSpeed"},{"type":"string","value":"100"}]}],"containers":[{"func":"blockSpheroSetSpeed","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueSpheroSpeed"},{"type":"choice","value":"+"},{"type":"string","value":"10"}]}]}]}} Add to my Backpack


{"func":"blockSpheroRoll"}

Roll For

Use "Roll For" to roll Sphero/Ollie for the specified time.

Parameters:

Seconds: amount of time to roll

Related Blocks:
{"func":"blockSpheroStop"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"forward"}],"next":{"func":"blockSpheroRoll","values":[{"type":"number","value":"99"}]}} Add to my Backpack


{"func":"blockSpheroStop"}

Stop Moving

Use "Stop Moving" to stop Sphero/Ollie from rolling.

Parameters:

None.

Related Blocks:
{"func":"blockSpheroRoll"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"break"}],"next":{"func":"blockSpheroStop"}} Add to my Backpack


{"func":"blockSpheroTurnCW"}

Turn Clockwise

"Turn Clockwise" turns Sphero/Ollie clockwise by the number of degrees

Parameters:

Angle: number of degrees to turn clockwise

Related Blocks:
{"func":"blockSpheroTurnCCW"} ,     {"func":"blockSpheroHeading"} ,     {"func":"valueSpheroHeading"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"right"}],"next":{"func":"blockSpheroTurnCW","values":[{"type":"string","value":90}]}} Add to my Backpack


{"func":"blockSpheroTurnCCW"}

Turn Counter-Clockwise

"Turn Counter-Clockwise" turns Sphero/Ollie counter-clockwise by the number of degrees

Parameters:

Angle: number of degrees to turn counter-clockwise

Related Blocks:
{"func":"blockSpheroTurnCW"} ,     {"func":"blockSpheroHeading"} ,     {"func":"valueSpheroHeading"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"left"}],"next":{"func":"blockSpheroTurnCCW","values":[{"type":"string","value":90}]}} Add to my Backpack


{"func":"blockSpheroHeading"}

Set Heading

"Set Heading" sets the heading of Sphero/Ollie. 0 is straight ahead.

Parameters:

Angle: number of degrees

Related Blocks:
{"func":"blockSpheroTurnCW"} ,     {"func":"blockSpheroTurnCCW"} ,     {"func":"valueSpheroHeading"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockSpheroHeading","values":[{"type":"string","value":"0"}]}} Add to my Backpack


{"func":"blockSpheroSetColor"}

Set Color

Use "Set Color" to set the color for the Sphero/Ollie.

Parameters:

Color: color to set to

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"purple"}],"next":{"func":"blockSpheroColor","values":[{"type":"color","value":"#C66BAA"}]}} Add to my Backpack


{"func":"valueSpheroSpeed"}

Speed

"Speed" returns the current speed of the Sphero/Ollie as a percentage.

Parameters:

None.

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"speed up"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpLess","values":[{"type":"wrapper","func":"valueSpheroSpeed"},{"type":"string","value":"100"}]}],"containers":[{"func":"blockSpheroSetSpeed","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueSpheroSpeed"},{"type":"choice","value":"+"},{"type":"string","value":"10"}]}]}]}} Add to my Backpack


{"func":"valueSpheroHeading"}

Heading

"Heading" returns the current heading of Sphero/Ollie.

Parameters:

None.

Related Blocks:
{"func":"blockSpheroTurnCW"} ,     {"func":"blockSpheroTurnCCW"} ,     {"func":"blockSpheroHeading"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"change"}],"next":{"func":"blockSpheroHeading","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueSpheroHeading"},{"type":"choice","value":"+"},{"type":"string","value":"10"}]}]}} Add to my Backpack


{"func":"valueSpheroConnected"}

Connected?

"Connected?" returns true if connected to Sphero/Ollie; otherwise returns false.

Parameters:

None.

Related Blocks:
{"func":"blockSpheroTurnCW"} ,     {"func":"blockSpheroTurnCCW"} ,     {"func":"blockSpheroRoll"} ,     {"func":"blockSpheroStop"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueSpheroConnected"}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"ready"}]}]} Add to my Backpack


{"func":"valueSpheroOdometer"}

Odometer

"Odometer" returns the total distance the device has traveled in centimeters.

Parameters:

None.


{"func":"valueSpheroProperty"}

Get Property

"Get Property" returns the specified device property of the device.

Parameters:

Property: the device property to get a value for.


{"func":"registerHardwareTrigger"}

When I collide

"When I collide" is called when the device collides with another object.

Parameters:

None.

Related Blocks:
{"func":"valueSpheroCollidedSinceLastCheck"}


{"func":"valueSpheroCollidedSinceLastCheck"}

collided since last check?

"collided since last check?" returns true if the device has collided with another object since "collided since last check?" was last called.

Parameters:

None.

Related Blocks:
{"func":"registerHardwareTrigger"}


{"func":"blockSpheroSetStabilization"}

set stabilization

"set stabilization" turns on or off internal stabilization of the device. Stabilization is enabled by default when the device is powered up.

Parameters:

Boolean: this parameter should be a boolean value (either true or false). If the value is false, device stabilization will be turned off. If the value is true, device stabilization will be turned on.


{"func":"blockSpheroSet"}

Set Device Value To

"Set Device Value To" sets a configuration value for the device.

Parameters:

Configuration Key: the name of a device configuration value

Value: the value to set to



Drone

{"func":"blockDroneMoveTo"}

Move Drone to

"Move Drone to" is a block that moves the drone to the supplied location.

Parameters:

Location


{"func":"blockDroneMoveBy"}

Move Drone by

"Move Drone by" is a block that moves the drone in the specified drirection and by the specified amount.

Parameters:

Distance


{"func":"blockDroneTurnLeft"}

Turn Left

"Turn Left" is a block that turns the drone's facing direction 90 degrees to the left.

Parameters:

None.


{"func":"blockDroneTurnRight"}

Turn Right

"Turn Right" is a block that turns the drone's facing direction 90 degrees to the right.

Parameters:

None.


{"func":"valueDroneDir"}

Drone Direction

"Drone Direction" is a value block that returns the current direction of the drone.

Parameters:

None.


{"func":"valueDronePosition"}

Drone Location

"Drone Location" is a value block that returns a location object representing the drone's postion.

Parameters:

None.


{"func":"blockDroneSetCheckpoint"}

Set Checkpoint

"Set Checkpoint" is a block that saves the drone's current location as a checkpoint with a specified name.

Parameters:

Location

Name


{"func":"blockDroneGoCheckpoint"}

Go to Checkpoint

"Go to Checkpoint" is a block that moves the drone to the checkpoint that matches the specified name.

Parameters:

Name


{"func":"blockDronePutBlock"}

Place Block

"Place Block" is a block that places a block of the specified type at the drone's current location.

Parameters:

Block


{"func":"blockDroneLineTo"}

Place Blocks on Line

"Place Blocks in Line" is a block that places series of blocks on a line between the drone's current location and the supplied location.

Parameters:

Block

Location


{"func":"blockDroneRect"}

Craft Box

"Build Box" is a block that places a filled or hollow box of blocks of the specified type and with the specified dimensions at the drone's curent location.

Parameters:

Filled

Block

Width

Height

Depth


{"func":"blockDroneCylinder"}

Craft Cylinder

"Build Cylinder" is a block that places a filled or hollow cylinder of blocks of the specified type and with the specified dimensions at the drone's curent location.

Parameters:

Filled

Block

Radius

Length

Wall Thickness

Direction


{"func":"blockDroneSphere"}

Craft Sphere

"Build Sphere" is a block that places a filled or hollow sphere of blocks of the specified type and with the specified dimensions at the drone's curent location.

Parameters:

Filled

Block

Radius


{"func":"blockDroneHemisphere"}

Craft Hemisphere

"Build Hemisphere" is a block that places a filled or hollow hemisphere of blocks of the specified type and with the specified dimensions at the drone's curent location.

Parameters:

Filled

Top

Block

Radius


{"func":"blockDronePrism"}

Craft Prism

"Build Prism" builds a prism out of the blocks specified at the drone's current location, extending in front of the drone for the specified width and height.

Parameters:

Block

Width

Depth


{"func":"blockDroneBlocktype"}

Write Text with Blocks

"Write Text with Blocks" writes letters in Minecraft blocks at the drone's current location.

Parameters:

Block

Text


{"func":"blockDroneSign"}

Craft Sign

"Build Sign" is a block that puts down sign post or wall sign at the drone's current location with the given messages.

Parameters:

SignType

Message 1

Message 2

Message 3

Message 4


{"func":"blockDroneDoor"}

Place Door

"Place Door" will place a door, or side-by-side double-doors, at the current drone position.

Parameters:

Width

Door


{"func":"blockDroneBed"}

Place Bed

"Place Bed" will place the foot of a bed at the drone's current location and the head of the bed 1 block in front of the drone.

Parameters:

None.


{"func":"blockDroneLadder"}

Place Ladder

"Place Ladder" This will place a climbable ladder at the drone's location extending upward the specified number of units.

Parameters:

Height

Sample Code:
{"cat":"drone","label":"place ladder with height:{number:1}","func":"blockDroneLadder"} Add to my Backpack


{"func":"blockDroneStairs"}

Place Staircase

"Place Staircase" builds a staircase at the drone's current location, extending in front of the drone for the specified width and height.

Parameters:

Staircase

Width

Height


{"func":"blockDroneCottage"}

Craft Cottage

"Craft Cottage" This builds a small cottage at the drone's current location.

Parameters:

None.


{"func":"blockDroneCottageRoad"}

Craft Road With Cottages

"Craft Road With Cottages" This will create a straight road with cottages on both sides. The number of cottages MUST be a multiple of 2, and the default is 6.

Parameters:

Number


{"func":"blockDroneCreateTree"}

Plant Tree

"Plant Tree" is a block that plants a tree of the specified kind at the drone's current location.

Parameters:

Tree


{"func":"blockDronePointCardinalDirection"}

Set Drone Direction

"Point Drone Direction" is a block that sets the direction of the drone

Parameters:

Direction


{"func":"blockDroneTakeOff"}

Take Off

"Take Off" makes the Parrot drone take off.

Parameters:

None.

Related Blocks:
{"func":"blockDroneLand"} ,     {"func":"blockDroneEmergency"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"takeoff"}],"next":{"func":"blockDroneTakeOff","next":{"func":"blockControlWait","values":[{"type":"number","value":"1000"}]}}} Add to my Backpack


{"func":"blockDroneLand"}

Land

"Land" makes the Parrot drone land.

Parameters:

None.

Related Blocks:
{"func":"blockDroneTakeOff"} ,     {"func":"blockDroneEmergency"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"land"}],"next":{"func":"blockDroneLand"}} Add to my Backpack


{"func":"blockDroneStop"}

Stop

"Stop" stops the Parrot drone from moving and puts it into a hover state.

Parameters:

None.

Related Blocks:
{"func":"blockDroneTakeOff"} ,     {"func":"blockDroneLand"} ,     {"func":"blockDroneEmergency"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"stop"}],"next":{"func":"blockDroneStop"}} Add to my Backpack


{"func":"blockDroneEmergency"}

Emergency

"Emergency" cuts off power to the Parrot drone.

Parameters:

None.

Related Blocks:
{"func":"blockDroneTakeOff"} ,     {"func":"blockDroneLand"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"emergency"}],"next":{"func":"blockDroneEmergency"}} Add to my Backpack


{"func":"blockDroneSetSpeed"}

Set Speed

Use "Set Speed" to set Parrot drone to the specified speed.

Parameters:

Speed: percentage speed

Related Blocks:
{"func":"blockDroneForward"} ,     {"func":"blockDroneBackward"} ,     {"func":"blockDroneLeft"} ,     {"func":"blockDroneRight"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockDroneSetSpeed","values":[{"type":"number","value":"50"}]}} Add to my Backpack


{"func":"blockDroneForward"}

Fly Forward

"Fly Forward" moves the Parrot drone forward at the specified speed.

Parameters:

Speed: percentage speed

Related Blocks:
{"func":"blockDroneBackward"} ,     {"func":"blockDroneLeft"} ,     {"func":"blockDroneRight"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"forward"}],"next":{"func":"blockDroneForward","values":[{"type":"number","value":"1"}]}} Add to my Backpack


{"func":"blockDroneBackward"}

Fly Backward

"Fly Backward" moves the Parrot drone backward at the specified speed.

Parameters:

Speed: percentage speed

Related Blocks:
{"func":"blockDroneForward"} ,     {"func":"blockDroneLeft"} ,     {"func":"blockDroneRight"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"backward"}],"next":{"func":"blockDroneBackward","values":[{"type":"number","value":"1"}]}} Add to my Backpack


{"func":"blockDroneLeft"}

Bank Left

"Bank Left" moves the Parrot drone left at the specified speed.

Parameters:

Speed: percentage speed

Related Blocks:
{"func":"blockDroneForward"} ,     {"func":"blockDroneBackward"} ,     {"func":"blockDroneRight"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"left"}],"next":{"func":"blockDroneLeft","values":[{"type":"number","value":"1"}]}} Add to my Backpack


{"func":"blockDroneRight"}

Bank Right

"Bank Right" moves the Parrot drone right at the specified speed.

Parameters:

Speed: percentage speed

Related Blocks:
{"func":"blockDroneForward"} ,     {"func":"blockDroneBackward"} ,     {"func":"blockDroneLeft"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"right"}],"next":{"func":"blockDroneRight","values":[{"type":"number","value":"1"}]}} Add to my Backpack


{"func":"blockDroneTurnCW"}

Turn Clockwise

"Turn Clockwise" turns the Parrot drone clockwise at the specified angle.

Parameters:

Angle: number of degrees to turn clockwise

Related Blocks:
{"func":"blockDroneTurnCCW"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"turn right"}],"next":{"func":"blockDroneTurnCW","values":[{"type":"string","value":30}]}} Add to my Backpack


{"func":"blockDroneTurnCCW"}

Turn Counter-Clockwise

"Turn Counter-Clockwise" turns the Parrot drone counter-clockwise at the specified angle.

Parameters:

Angle: number of degrees to turn clockwise

Related Blocks:
{"func":"blockDroneTurnCW"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"turn left"}],"next":{"func":"blockDroneTurnCCW","values":[{"type":"string","value":30}]}} Add to my Backpack


{"func":"blockDroneAnimation"}

Flip

Use "Flip" to flip the Parrot drone while flying.

Parameters:

Direction: direction to flip - forward, backward, left or right.

Related Blocks:
{"func":"blockDroneForward"} ,     {"func":"blockDroneBackward"} ,     {"func":"blockDroneLeft"} ,     {"func":"blockDroneRight"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"back flip"}],"next":{"func":"blockDroneAnimation","values":[{"type":"string","value":"flip backward"}]}} Add to my Backpack


{"func":"blockDroneUp"}

Fly Up

"Fly Up" moves the Parrot drone upwards.

Parameters:

Speed: percentage speed

Related Blocks:
{"func":"blockDroneDown"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"rise"}],"next":{"func":"blockDroneUp","values":[{"type":"number","value":".5"}]}} Add to my Backpack


{"func":"blockDroneDown"}

Fly Down

"Fly Down" moves the Parrot drone downwards.

Parameters:

Speed: percentage speed

Related Blocks:
{"func":"blockDroneUp"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"lower"}],"next":{"func":"blockDroneDown","values":[{"type":"number","value":".5"}]}} Add to my Backpack


{"func":"valueDroneConnected"}

Connected?

"Connected?" returns true if connected to Parrot drone; otherwise returns false.

Parameters:

None.

Related Blocks:
{"func":"blockDroneForward"} ,     {"func":"blockDroneBackward"} ,     {"func":"blockDroneLeft"} ,     {"func":"blockDroneRight"}

Sample Code:
{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueDroneConnected"}],"containers":[{"func":"blockControlBroadcast","values":[{"type":"string","value":"ready"}]}]} Add to my Backpack



Hue

{"func":"blockHueState"}

Turn Light On/Off

"Turn Light On/Off" turns the Philips Hue light on (true) or off (false).

Parameters:

State: true - on, false - off

Related Blocks:
{"func":"valueHueState"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockHueState","values":[{"type":"boolean","value":"true"}]}} Add to my Backpack


{"func":"valueHueState"}

On?

"On?" returns whether the Philips Hue light is on (true) or off (false).

Parameters:

None.

Related Blocks:
{"func":"blockHueState"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"turn off"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueHueState"}],"containers":[{"func":"blockHueState","values":[{"type":"boolean","value":"false"}]}]}} Add to my Backpack


{"func":"blockHueColor"}

Set Color

"Set Color" sets the RGB color for the Philips Hue light.

Parameters:

Color: the color value

Related Blocks:
{"func":"blockHueSetHue"} ,     {"func":"blockHueChangeHue"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockHueState","values":[{"type":"boolean","value":"true"}],"next":{"func":"blockHueColor","values":[{"type":"color","value":"#ff0000"}]}}} Add to my Backpack


{"func":"blockHueSetHue"}

Set Color Hue

"Set Color Hue" sets the color hue for the Philips Hue light.

Parameters:

Hue: color hue from 0-100

Related Blocks:
{"func":"blockHueColor"} ,     {"func":"blockHueChangeHue"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockHueState","values":[{"type":"boolean","value":"true"}],"next":{"func":"blockHueSetHue","values":[{"type":"number","value":"35"}]}}} Add to my Backpack


{"func":"blockHueChangeHue"}

Change Color Hue By

"Change Color Hue By" changes the color hue for the Philips Hue light.

Parameters:

Amount: amount to change the hue by

Related Blocks:
{"func":"blockHueColor"} ,     {"func":"blockHueSetHue"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"red"}],"next":{"func":"blockHueChangeHue","values":[{"type":"number","value":"-5"}]}} Add to my Backpack


{"func":"blockHueBrightness"}

Set Brightness

"Set Brightness" sets the brightness for the Philips Hue light.

Parameters:

Brightness: the brightness (0-100)

Related Blocks:
{"func":"valueHueBrightness"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockHueState","values":[{"type":"boolean","value":"true"}],"next":{"func":"blockHueBrightness","values":[{"type":"number","value":"100"}]}}} Add to my Backpack


{"func":"valueHueBrightness"}

Brightness

"Brightness" returns the current Philips Hue light brightness (from 0-100).

Parameters:

None.

Related Blocks:
{"func":"blockHueBrightness"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"dim"}],"next":{"func":"blockHueBrightness","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueHueBrightness"},{"type":"choice","value":"-"},{"type":"string","value":"10"}]}]}} Add to my Backpack