As Easy As Click, Click, Code!
Total Page:16
File Type:pdf, Size:1020Kb
As easy as click, click, code! v A motivational learning system Programming Reference Document 45284 Contents Interface Overview ..........................................................................................................................................................1 The Fable PC Interface – Blockly ...........................................................................................................................................................1 The Fable PC Interface – Python ...........................................................................................................................................................2 Simple-View Blocks ..........................................................................................................................................................3 Logic .................................................................................................................................................................................................................3 Actions .............................................................................................................................................................................................................4 Loops ................................................................................................................................................................................................................5 Colors ...............................................................................................................................................................................................................6 Senses ..............................................................................................................................................................................................................7 Camera ............................................................................................................................................................................................................8 Data...................................................................................................................................................................................................................9 Math ..............................................................................................................................................................................................................10 Full-View Blocks .............................................................................................................................................................11 Logic ..............................................................................................................................................................................................................11 Actions ..........................................................................................................................................................................................................12 Loops .............................................................................................................................................................................................................13 Colors ............................................................................................................................................................................................................14 Functions .....................................................................................................................................................................................................15 Senses ...........................................................................................................................................................................................................16 Camera .........................................................................................................................................................................................................17 Data................................................................................................................................................................................................................18 Variables .......................................................................................................................................................................................................19 Lists ................................................................................................................................................................................................................20 Math ..............................................................................................................................................................................................................21 Python API ......................................................................................................................................................................22 Joint Module ..............................................................................................................................................................................................22 Face App ......................................................................................................................................................................................................23 Sounds and Lights ...................................................................................................................................................................................23 Camera .........................................................................................................................................................................................................24 Setup and Termination ..........................................................................................................................................................................24 Module Handling .....................................................................................................................................................................................25 Time and Wait ............................................................................................................................................................................................25 Testing Communication ........................................................................................................................................................................25 Print, Plot, and Data Logs .....................................................................................................................................................................25 Support Contact .............................................................................................................................................................26 Contact .........................................................................................................................................................................................................26 45284 INTERFACE OVERVIEW The Fable PC Interface – Blockly Users can program their robots by using the Fable software. The interface supports both block-1 and text-based2 programming. The software supports three complexity levels: Simple: Block-based programming for beginner or younger children. A limited number of blocks makes the interface easily accessible. Full: Block-based programming for more experienced or older students. Blocks support more advanced features such as math, functions, logic, and variables. Python®: Text-based programming using the Python programming language. Block categories Run/stop code Project folders Open settings Start video stream Status bar Open documentation Python equivalent code Change to Python mode Plotting area 1 Based on Google Blockly 2 Based on Python 1 INTERFACE OVERVIEW The Fable PC Interface – Python The Fable robots can be programmed in the Python language. Any block program will automatically be translated into Python code, which can then be modified and extended by the user. Run/stop code Project folders Open settings Start video stream Python output area Open documentation Status bar Change to Blockly mode 2 SIMPLE-VIEW BLOCKS Logic If a value is true, then run the statements. Click the gear icon to add an else statement. Returns true or false depending on the input parameters and the operator selection. Returns true or false depending on the input parameters and the operator selection. • And – Returns true if both inputs are true. • Or – Returns true if at least one input is true. A Boolean variable that returns either a true or false value. 3 SIMPLE-VIEW BLOCKS Actions Changes the light color on a joint module or dongle; will not change the communication channel. Plays back a standard audio sound on the computer. Sets the angle that Servo X or Y on the joint module should move to in degrees from -90 to 90. Sets the emotion of the robot’s face app on the smartphone. Makes the face module vibrate. 4 SIMPLE-VIEW BLOCKS Loops Pauses the program for a number of seconds. While a value is true, then run the statements. 5 SIMPLE-VIEW BLOCKS Colors Chooses