Code Playground A BlockBased Language Designed for the
Code. Playground: A Block-Based Language Designed for the Adafruit Circuit Playground Abstract Engineering Goal With the growing use of technology in our everyday lives, the need for more people who can program and understand technology is increasing. However, the engaging resources to teach computer science incorporating hardware components to children and firstlearners, are limited. To combat this issue, a block-based language was developed using Google’s Blockly Developer Tools. The Blockly library injects an editor into an HTML file that represents coding concepts as interlocking blocks, and then outputs the blocks as syntactically correct code. This block-based language, appropriately, named Code. Playground, was designed to be compatible with the Adafruit Circuit Playground. The Circuit Playground was released as an all-in-one low cost device that can be used for education. Code. Playground allows teachers to utilize the Circuit Playground as an educational device that includes both hardware and software elements. The Circuit Playground uses the firmata provided by Adafruit to communicate with the Python code generated by Code. Playground. Blockly Developer Tools was used to create the frame for the language and Atom was used to insert the specialized Java. Script for code generation. After the language was complete, 90 sample programs were created then given a score on a scale of 0 to 2 based on difficulty and their ability to generate and run code, with 2 being the most difficult and most successful, respectively. All of the programs successfully generated code and ran 94% of the time, demonstrating that Code. Playground could be used in an educational setting. Goal is to develop a drag-and-drop language that utilizes the hardware appeal of the Adafruit Circuit Playground to teach computer science concepts to younger children in a way that keeps them actively engaged. Code Generation Data Collection and Analysis Figure 1 Materials • • Computer with Windows 7 operating system or later, a modern browser and Python 2. 7+ Atom Circuit Playground with Micro USB Cable Blockly Procedure Write sample programs to become familiar with Circuit Playground Download Blockly and run sample programs Learn Java. Script and HTML to create sample programs with Blockly Compile list of needed blocks Use Blockly Developer Tools to make the frame for each block Add code generation specific Java. Script using Atom Create sample programs using Code. Playground to test the language Download and install dependencies to program Circuit Playground Figure 1: Java. Script used in code generation that autoindents the Python code that is executed when the right-hand button is pressed and released. Example Code. Playground Program Figure 2 Figure 3 Ninety sample programs were generated in Code. Playground and tested based on their ability to generate code and run. A score of 0, 1, or 2 was given based off of a predefined criteria where 0 is when Code. Playground does not generate the code, 1 is Code. Playground generates codes but the Python code has a runtime error, and 2 is Code. Playground successfully generates code and the Python code successfully runs. Each program was also assigned a level of 0, 1, or 2 based on their difficulty level. A zero is the easiest program and involves simple tasks such as printing a string or value when a button is pressed. A one is a medium difficulty program which involves use of sensor values to perform certain tasks. A level of two is the highest difficulty and involves variable manipulation and use of variables in event triggered functions such as a switch being changed (see Figures 2 -5 for example). Of the ninety programs, all generated code, and 94. 4% ran successfully. The errors were all due to variable type mismatch or index out of bound errors on Circuit Playground specific functions such as board. set_pixel(). Difficulty Did Not Generate Code (0) Runtime Error (1) Ran and Generated Code (2) Average Rating Easy (0) 0 0 30 2 Medium (1) 0 2 28 1. 96 Hard (2) 0 3 27 1. 9 Figure 4 Table 1 Conclusion / Future Work Figure 5 Overall, Code. Playground was successful in being able to program the Circuit Playground from a block-based environment. While it does have a few minor bugs that can cause runtime errors in Python, these can be fixed with further testing. The type of programs where Code. Playground had run-time errors were extremely difficult and would most likely not be used in education, which is out of the intended scope of the language. Code. Playground can be effectively used as an educational tool that integrates hardware to teach software. To further improve the language, the ability to download code directly from the browser to the device could be added and for Code. Playground to catch variable type mismatch errors. To allow code to be downloaded from the browser, the language would have to generate C code which would allow a simpler initial setup of the programming environment, creating a near plug-and-play system. References Figure 2 shows a program made in Code. Playground that increases the number of Neo. Pixels illuminated based on the noise level detected by the sound sensor. Figure 3 shows the Python code generated by the specific blocks (code generated that is not block specific not shown). Figure 4 shows the program running at a normal sound level (approximate value of 300 returned from sound sensor) and Figure 5 shows the device after receiving a loud noise (approximate value of 900 returned from sound sensor). • Ada, L. (2016, April 26). Introducing Circuit Playground. Retrieved August 22, 2016, from https: //learn. adafruit. com/introducing-circuit-playground • Di. Cola, T. (2016, April 27). Circuit Playground Firmata. Retrieved September 06, 2016, from https: //learn. adafruit. com/circuitplayground-firmata • Hoffer, B. M. (2012). Satisfying STEM Education Using the Arduino Microprocessor in C Programming (Report No. 1472). Electronic Theses and Dissertations. Retrieved from http: //dc. etsu. edu/etd/1472. • Introduction to Blockly. (2016, June 23). Retrieved August 22, 2016, from https: //developers. google. com/blocklys/guides/overview Rubio M. A. , Mañoso C. , Hierro, Pérez A. (2013, July). Using Arduino to Enhance Computer Programming Courses In Science And Engineering. (ISBN: 978 -84 -616 - 3822 -2). •
- Slides: 1