Development and Use of a Programming ...

4 downloads 6919 Views 2MB Size Report
programming environment “PEN” for simulating. “LilyPad ... measurements and controls via computer programs. On the third topic there are many research ...
Development and Use of a Programming Environment for Learning the Mechanism of Measurement and Control by Programs Tomoko Yoshida1, Toshiyuki Kamada2, Ryota Nakamura3 and Toshio Matsuura3 1 Kyoto Notre Dame University, Japan 2 Aichi University of Education, Japan 3 Osaka City University, Japan 1 [email protected], 2 [email protected], 3 [email protected], [email protected] ABSTRACT Since 2012, “the mechanism of measurement and control by programs” has become required in junior high school in the subject “Technology and Home Economics” in Japan. In order to enrich and fulfill the purpose of class activities for that topic, we designed additional functionality in our programming environment “PEN” for simulating “LilyPad Arduino”microcontroller boards on the screen. In this paper, we describe the design and implementation of that simulator and report the results of practical lessons that we conducted with female university students. We compared the outcomes of two groups of learners: (1) those who finished with a graphics programming environment on the screen in 2013, and (2) those who proceeded to program microcontrollers with this learning environment in 2014. The latter group showed quite positive reactions. They could feel some degree of success in programming.

KEYWORDS Learning Programming, Measurement and Control, Wearable Electronics, Physical Programming, Simulation before Practice

1 INTRODUCTION In Japan, the revised national curriculum for Primary and Secondary Education was issued in 2012 [1]. The new topic of “measurement and control by programs” is incorporated as compulsory at the lower high school level for the subject of “Technology and Home Economics.” This additional topic is a part of the goal of focusing on making students understand

ISBN: 978-1-941968-18-5 ©2015 SDIWC

various contemporary technologies in daily life, and this requires educators to design and implement even more practical lessons to learn the mechanism of computational devices and how computers work by experiencing programming that includes the use of sensor data and physical reactions such as rotating motors, lighting LEDs, or making sounds by students themselves. The area of “Technology of Information Processing” in this subject is composed of three parts: (1) information communication networks and ethics, (2) design and production of digital works, and (3) automatic measurements and controls via computer programs. On the third topic there are many research papers and reports of practical lessons that use mobile robot programming [2] [3] ; however, in our survey of the literature other teaching materials still seem not to be considered. In order to enhance learning materials for measurement and control by programs, we focused on wearable electronics, which is a movement of crafting electric circuits that can be worn or carried, dedicated to the user’s body like accessories [4] [5]. In this movement, electronic elements such as batteries, switches, and LEDs are sometimes sewn with conductive threads rather than soldered. An Arduino [6] microcontroller board, “LilyPad” [7] is designed to fit to sew on fabrics. With the program of LilyPad, LEDs can flash and beeper speakers emit sounds according to the logic of programs by using the sensor inputs such as ambient light, sounds, motion of tactile switches, etc.

32

In this paper we first introduce our programming environment for novice programmers (PEN) [8] [9] as a base of learning materials. Enhancements for programming the LilyPad Arduino with PEN and the design and implementation of the LilyPad simulator for PEN are described. Then we report the results of an empirical questionnaire study of the effectiveness of learning programming by university students as novice learners. Finally discussions and suggestions for future works are shown. 2 LEARNING ENVIRONMENT WITH PEN AND LILYPAD 2.1 PEN: Programming Environment for Novices The programming environment with this research is PEN. The basic design of the programming language of PEN is an extension of DNCL, which is defined by National Center for University Entrance Examinations as a descriptive language for composing computer algorithms in questions and answers for the common university entrance exam held by that agency in Japan. Because the syntax of DNCL has strong similarities to conventional structured procedural programming languages, and it is the only official one that can be used in the entrance exams, we chose this as a base of our programming language that can be used as learning materials in lessons at schools. In this language, the keywords such as 'if' and 'then' are written in Japanese, our own language. Therefore novices easily understand the points without translations. Extensions to DNCL are required to be able to run DNCL code on real computers, such as operations on data. PEN is an IDE for this extended DNCL (named “xDNCL”) that is composed of a code editor area, an interactive language processor (interpreter) with a user interface that displays the currently executing line of code, run/break/step-execution buttons, and values of defined variables. They all are intended for

ISBN: 978-1-941968-18-5 ©2015 SDIWC

beginners to easily learn how computer programs are written and executed on machines. In addition, PEN has “code input assist” buttons, each with a description corresponding to each structure in xDNCL such as branches and loops. By clicking each button, a piece of code with exact syntax is inserted into the editor. This is very convenient both for learners and educators in their lessons by avoiding wrong typing and showing how computer programs are written. This feature is only a support for typing. Thus programmers can break the structure, which might cause syntax errors, by editing input code. A policy of PEN is that the experience of syntax errors is necessary to learn programming steadily. Figure 1 shows a screen of the PEN environment. PEN is implemented as a Java application with a plug-in system for easy extension of this environment in various aspects. Details of extensions that we made for different requirements are described later.

Figure 1. Screen of PEN

2.2 LilyPad Development Board We embraced the LilyPad Arduino by SparkFun Electronics in our study. This board is intentionally designed for wearable electronics that can control such as LEDs with programs in the Arduino language, and by

33

connecting (including sewing with conductive thread on fabrics) sensor modules, it can realize interactive wearable devices that respond to the environment or to human operations. The LilyPad Development Board (Figure 2) is a product for users to start using LilyPad for wearable and physical computing projects. This is a single board. It contains one LilyPad Arduino, one tactile switch, one slide switch, five white LEDs, one RGB color LED, one light sensor, one temperature sensor, one beeper speaker, and one vibration motor (used in mobile phones) on single circuit board. The kit of this board includes one 110mAH Polymer Lithium Ion battery as an attachment power source, bobbins of conductive thread, a set of needles for sewing, and an FTDI USB-Serial adapter board for writing programs to LilyPad from a PC. All components on the developing board are connected to LilyPad Arduino, but they can easily be cut out into independent components for a user’s own circuit design project. In this study, we started with this board as it is, not allowing learners to cut out any components from the board in order to avoid suffering from thinking about circuits and confusing which devices were connected to which pins of the LilyPad Arduino.

language, and we implemented them in the PEN system [10] [11]. Extended functions to xDNCL are as follows: (1) pinMode(pin, iomode) set the pin to specified iomode: one of “digitalin / digitalout / analogin / analogout” (2) digitalRead(pin) read the status of the pin and return either 0 (low) or 1 (high) (3) digitalWrite(pin, value) set the status of the pin to either 0 or 1 (4) analogRead(exp) read the voltage of the pin specified by exp as 10bit ADC integer (5) analogWrite(pin, value) output PWM duty cycle as 8bit integer value to the pin

Figure 3. Flow of from PEN to LilyPad Arduino

Figure 2. LilyPad Development Board Kit

2.3 Extension of PEN for LilyPad Arduino We made an extension to xDNCL to support sensor input and control output features in conformance to the Arduino ISBN: 978-1-941968-18-5 ©2015 SDIWC

They are implemented with the plug-in system of PEN. The above functions are attached to the language processor with a “functionTable.ini” file that is read at the startup of PEN. In this table, the name of each function and corresponding implementation as class and method name written with Java are aligned line by line, thus the language processor can execute the implemented function that appears in xDNCL 34

code with its name. Plug-ins are in directories which contain “.class” (compiled Java class module) files and other related files under the “plugin” directory of the PEN system (Figure 3). In this case, we also include the code for attaching another menu item, “Arduino,” including, “Convert Program,” and “Write to Arduino.” When a user selects “Write to Arduino,” converting from xDNCL to Arduino language, compiling it, and uploading the resulting binary to LilyPad is done with one step. When a user selects “Convert Program,” the language processor converts the code from extended xDNCL to Arduino language as a saved sketch file and stop processing. In the latter case, the user can open, examine and upload the sketch into LilyPad by operating the Arduino IDE. 2.4 LilyPad Board Simulator on PEN As a learning environment for programming physical devices, the embedded simulator of the devices is a help for learners because they can concentrate on the logic of the program rather than thinking of behaviors of real circuits. The typical situation of this advantage is while writing the code for checking the status of the sensor input value. Novice programmers and novice learners of electrical circuits might not find out where a problem is in a total system if it does not work correctly. Furthermore, for some advanced programmers, running the code with a real-time interactive simulator is helpful to check if the code behaviors with varying analog values of the sensor are working well or not. In actual lesson situations, programming with a simulator first will enable sharing time for using fewer real physical devices. In this situation, learners use real devices to confirm if their programs work correctly or not and to understand real behavior of the code by measuring the environment with the sensors. Then, we designed and implemented “LilyPad [12] simulator for PEN” as a plug-in . In order to simplify the design, we only

ISBN: 978-1-941968-18-5 ©2015 SDIWC

consider LilyPad Development Board as a target device (Figure 4). The simulator runs as an independent thread within the PEN environment and shares the status of values with running code for both. Under this design, and the feature of PEN that can slow down running speed of the code by operating the slider handle and step execution button, learners can simultaneously see the lines PEN executes, the values in the code, and how electric devices interact with the code from the display of LEDs, etc. The interaction is realized by operating the controls on the screen of the simulator while running a block of code, for example, by clicking the picture of a switch or dragging the slider bar for changing the value of an analog sensor. The screen of the simulator is based on the photo picture of the board, and changes of the status of each device are displayed by drawing rectangles on the picture, reflecting to the light of LEDs or status of switches, immediately and accurately.

Figure 4. LilyPad Board simulator on PEN

35

3 RESEARCH METHOD The primary goal of this study is to clarify the set of elements that foster good understanding of the mechanism of measurement and control by programs in an empirical study approach with investigating feedback from learners who experienced programming micro-controllers with sensors and actuators. In this aspect, we suppose that the core concepts that learners need to acquire are that (1) everything computed in the microcontroller is data as binary numbers in the memory even if it came from the sensor through input ports, (2) controlling actuators such as LEDs with microcontrollers is also a programmed operation of binary numbers for output ports, and (3) interactive behavior caused by sensors to actuators connected to a microcontroller is realized with a program to compute data from sensors and operate actuators according to the result of computation. In that sense, we extended PEN to program the LilyPad Arduino with an easy to learn programming language, xDNCL, and implemented a simulator of the LilyPad Developing Board. It can see lines of the code that take an input value from a sensor, change variables as a result of computation, and change the state of an output port to operate an actuator. Thus, our research questions in this study became as follows:

In the 2014 course learners experienced programming microcontrollers with sensors and actuators by both using a simulator and actual developing boards instead of graphics exercises. The gathered data were analyzed to determine how much the learners understood each step of developing new programming skills during each course as their outcomes, as well as any impressions they had [13]. 4 EXPERIMENTAL LESSONS The experimental lessons were held in the elective course of “Information Processing” in both 2013 and 2014 fall semesters at Kyoto Notre Dame University. The rationale of this course is to develop academic skills of computer network usage and computer programming for understanding the basis of our life surrounded with digital and networked products and equipment. Students are a mixture of freshman and sophomores. Because Kyoto Notre Dame is a women’s university, all students in the course were females. The period of each lesson was 90 minutes, and outline of lessons was as in Table 1.

(Q1) Does this learning environment steadily raise the outcomes to have basic skills of programming? (Q2) Does the simulator help learners demonstrate better understanding of core concept of programming as data operation? In order to answer the above questions, we recorded the observations of learners and administered a questionnaire sheet after each lesson in both 2013 and 2014 courses. The content of the 2013 course was completed with a graphics programming for the screen by commands for drawing shapes with color.

ISBN: 978-1-941968-18-5 ©2015 SDIWC

The first three lessons were the same in both 2013 and 2014. Lesson 4 in 2014 was designed for a final project at first, but students needed time to become familiar with 36

LilyPad and the simulator because their operations are different from merely learning additional functions of drawing graphics. More detailed contents of Lessons 4 and 5 in 2014 are described in the next section. 5 RESULTS The number of attendees was 68 in 2013 and 69 in 2014. Figure 5 is a summary of questions about how much the participants thought they understood the descriptions and exercises in each lesson in 2013. For Lesson 3 very few answered that they understood “very well” and “well” became relative to other lessons. Because the topic of Lesson 3 is iteration, it is considered that how to use the repeat structure is difficult to figure out for learners. This result is consistent with other reports on novice programmers that the usage of iteration is a pitfall for them. The reason why answers of “very well” and “well” reached to 60% in Lesson 4 may be that because this lesson contains diverse exercises including sequence execution, conditions, and iteration for drawing pictures, learners enjoy their work of putting colorful shapes rather than having stress from thinking of

calculation exercises that were concentrated only for iteration processing. Figure 6 is a summary of the same question to participants in 2014. In this case, the self-evaluation of learners for Lesson 3 looks better than in 2013. This might be a strong effect of the existence of a powerful helping assistant in this year. However, the trend of increasing the ratio of “average” and “not well” looked the same as before. This would suggest that learners still had a feeling of difficulty in Lesson 3. For Lesson 4 a typically worse answer was that about 42% learners reported “not well.” One reason worth considering is that LilyPad Arduino and its simulator on PEN are fresh for them. Learners might feel stress until they adapt to operating in new environments during the lesson. Another reason could be a mismatch of our preparation of this lesson to learners. In Lesson 4 we describe the example codes for (1) sequentially blinking the LED, (2) sequentially changing the color of fullcolor LED, (4) combining the status of tactile and slide switches to the blink of the light with a conditional loop, (5) changing the duration of blinking the LED according to a value from a light sensor, and finally, (6) we gave an exercise of trying to modify the

Figure 5. How much you understood in each lesson in 2013 (N is the number of available answers)

ISBN: 978-1-941968-18-5 ©2015 SDIWC

37

Figure 6. How much you understood in each lesson in 2014 (N is the number of available answers)

inequality in the nested branch example code that can easily select the color of the fullcolor LED by comparing it with the value of light sensor. During the exercises, we observed the learners’ trials of testing their code by moving the slider on the simulator to set a value of a virtual light sensor. After seeing this bad reputation of Lesson 4, we decided to start from showing a sample “wearable electronics” work, made by a course facilitator, “Piano Bag,” (Figure 7) for the purpose of motivating learners to work with LilyPad more.

Figure 7. Piano Bag

ISBN: 978-1-941968-18-5 ©2015 SDIWC

The Piano Bag is composed of a LilyPad, eight tactile switches and LEDs, beeper speaker, and a light sensor. They are sewn on the surface of a hand-made cotton bag with conductive thread. It can play a simple melody by pushing tactile switches with the blinking of corresponding LEDs. This bag also has an automatic play mode. In this mode, the value of the light sensor is a key to select one of two pre-set songs. The learners worked on exercises to modify the example code that (1) blinked the LEDs a fixed number of times and (2) lit the

Figure 8. The setting of the lab

38

two individual LEDs according to which tactile and slide switches were set to on by modifying the fourth example shown in Lesson 4. These exercises were somewhat easier than before, so learners actively worked on both of them on the simulator and actual LilyPad Arduino boards. After seeing their code running on a real LilyPad board, some learners showed their delight with applause for their classmates. Moreover, during this exercise, some learners advanced to add code for lighting additional LEDs with remaining switches and tried different patterns of blinking. The setting of this lab classroom is shown in Figure 8. Figure 9 is a summary of interest among participants in 2014. Though Lesson 4 had a bad reputation, learner’s comments on it were positive. Surprisingly, on the questionnaire sheet for Lesson 4, 82% of learners wrote, “It was difficult, but “interested” or “very interested.” In addition, for Lesson 5, on a question with a Likert Scale that asked if the lesson was fun or not, totally 90% of the learners answered “interested” or “very interested.” By looking at the comments on the sheet, this positive reaction was derived

from their successful feeling of having their programs work on a real device. Some typical comments (translated from Japanese) were as follows: “I felt very happy when I wrote my program to LilyPad and see actual work what I intended to do.” “I sensed big fulfillment and joy.” “I feel so really nice and cool when I could do well with my code as a work of my tough thinking.” 6 DISCUSSION Generally, students of 2014 felt achievement of learning some skills of controlling digital devices with their programs. With that meaning, we can answer our Research Question 1, “Does this learning environment steadily raise the outcomes to have basic skills of programming?” Judging from the activity and comments by the students, the environment seems to help them learn well and with pleasure. As for Research Question 2, “Does the simulator help learners demonstrate better understanding of core concept of

Figure 9. How much you were interested in each lesson in 2014 (N is the number of available answers)

ISBN: 978-1-941968-18-5 ©2015 SDIWC

39

programming as data operation?” we could answer positively from observations during lessons. Both students who finished well and those who were unable to finish operated the simulator frequently as a tool for making sure their hypotheses worked during their exercises. However, how much the students thought of data operations by composing or modifying the code cannot be determined from these experimental lessons. Deeper insight into how to approach and investigate this question is needed. 7 CONCLUSION In order to clarify the set of elements that foster good understanding of computer programming and mechanisms of measurement and control by programs, which is computation of data acquired from sensors and effects on the external environment by controlling actuators, we focused on wearable electronics and made PEN, our programming environment for novice programmers that can support development for such devices. Our first trial with female university students resulted in positive reactions from them. They could feel some degree of success in programming. Deeper understanding requires more empirical study by using these learning materials with various users, including K-12 students, with more well-designed courses and methods of collecting and processing data. In order to find more possibilities of our approach, there is a need for the development of more learning materials that school teachers can try in their lessons and courses. ACKNOWLEDGEMENTS The authors would like to express special thanks to Gregory Peterson (Professor Emeritus, Kyoto Notre Dame University) for his kind review of this English manuscript. This work was supported by JSPS KAKENHI Grant Number 25350563.

ISBN: 978-1-941968-18-5 ©2015 SDIWC

REFERENCES [1] Ministry of Education, Culture, Sports, Science and Technology Japan, Curriculum for Lower Secondary Schools, Chapter 8: Technology and Home Economics, April 2011. http://www.mext.go.jp/component/a_menu/ education/micro_detail/__icsFiles/afieldfile/2011/ 04/11/1298356_9.pdf Accessed: July 15, 2015. [2] S. Kurebayashi, T. Kamada, and S. Kanemune, Learning Computer Program with Autonomous Robots,LNCS 4226, Springer, 2006, pp. 138-149. [3] G. B. Demo, Robot Programming Integrated in a Junior High School Curriculum, Proc. Informatics Education Europe IV Conf., Freiburg, November 2009, pp. 56-63. [4] K. Hartman,“Make: Wearable Electronics: Design, prototype, and wear your own interactive garments,” Maker Media, Sep. 2014. [5] L. Buechley, K. Qiu,“Sew Electric: A Collection of Diy Projects That Combine Fabric, Electronics, and Programming” HLT Press, Oct. 2013. [6] Arduino: http://www.arduino.cc/ Accessed: July 15, 2015. [7] LilyPad Arduino: http://lilypadarduino.org/ Accessed: July 15, 2015. [8] T. Nishida, A. Harada, T. Yoshida, R. Nakamura, M. Nakanishi, H. Toyoda, K. Abe, H. Ishibashi, and T. Matsuura, PEN: A Programming Environment for Novices – Overview and Practical Lessons –, Proc. Ed-Media, AACE, June 2008, pp. 4755-4760. [9] PEN Project: http://www.media.osaka-cu.ac.jp/PEN/ Accessed: July 15, 2015. [10] T. Nishida, R. Nakamura, L. Lu, C. M. Thu, and T. Matsuura, Development of Learning Support Software and Educational Materials for Studying Measurement and Control by Programs, Proc. EdMedia, AACE, June 2013, pp. 108-124. [11] T. Yoshida, N. Yamaguchi, R. Nakamura, M. Nakanishi and T. Matsuura, Courseware for Using Handicrafts to Learn the Mechanism of Measurement and Control by Programs: PEN to Develop Programs for LilyPad Arduino, 2014 PC Conference, pp. 38-41, August 2014. (in Japanese) [12] R. Nakamura, T. Yoshida and T. Matsuura, Development of LilyPad Arduino Simulator and its Environment for Learning Measurement and Control by Programs, The 77th National Convention of IPSJ, 3H-01, 4-565-4-566, March 2015.(in Japanese) [13] T. Yoshida, R. Nakamura and T. Matsuura, Dev elo p me nt and U se o f a P ro gra mmi n g Environment of Learning the Mechanism of Measurement and Control by Programs, CE of I P SJ , 2 0 1 5 - C E - 1 2 8 ( 1 5 ), 1 - 1 0 , F e b . 2 0 1 5 . (in Japanese)

40

Suggest Documents