Abstracting SET COLOR — and Connecting to Prior Learning

Have you ever had one of those learning experiences where you thought you knew something going in (and knew it pretty well)…but then someone looked at a problem/task/question in a different way…and their approach broadened and deepened your understanding of what you thought you “knew”…? Those are some of my favourite learning experiences! Where I add connections and understanding to my knowledge by learning from others who think differently and/or who approached a task in a different way.

Here’s an example of just such a learning experience where a fellow educator recently deepened and broadened my understanding of the SET COLOR command on the TI-Innovator.

First, some background. Earlier this month, during a Teaching Computer Science with TI-Nspire workshop, we spent lots of time exploring different data types (including strings, floats, ints, etc.) and working with input and output commands related to these data types.

We learned how to Display output to the program’s user, including output made of different data types such as in the hypotenuse program shown below:

Running the hypotenuse program with actual parameters of 3 and 4 yields:

We informally called this use of the comma (,) in the Disp command concatenation, but then we were challenged to think more deeply about our use of this term later on. For now, we realized that the Disp command had syntax of:

Disp __, __, __, …

where any given blank could contain a string (in quotes) or a variable (string variable or numeric variable).

We later realized that the comma wasn’t our only (or even best?) way to concatenate, as we discovered when we ran into a program like this:

In this case, with the Request statement, we couldn’t use the comma to “concatenate” as we had done before with the Disp statement. We realized that this was due to the syntax of the Request statement, which looks something like this:

Request “[message to user]”,variable_to_store_response

The comma wouldn’t work to “concatenate”/connect output together here, since the Request statement was only expecting one comma in its syntax. (Side note: Request can actually receive a second comma followed by a 0 to suppress the user input, but that’s another story…! :))

Instead, we used the ampersand (&) to concatenate within the Request statement shown above.

From there, we wondered whether the comma (,) really had been concatenating for us earlier. We set off to investigate this further.

What do you think the output of this program would be?

Notice how the numeric variable age displays without a problem when using the comma (,) to separate Disp elements, but must be converted into a string (using the string() command) in order to be displayed using the ampersand (&) for concatenation. We had many interesting discussions about these details…!

Here is the output from running this program:

Notice anything interesting…?

We noticed some spacing issues. Namely, that the Disp __,__,__ approach inserted a space between each __ element, while the Disp [string]&[string]&[string] approach did not insert spaces between the various strings (as is true of typical concatenation).

Interesting… We were stretching our thinking and making connections about data types, output formatting, and concatenation methods.

Then, came this activity late in the second day…

We were learning how to code output to the RGB LED that is built into the TI-Innovator. We quickly learned that the syntax for sending colours to the RGB LED is:

Send “SET COLOR # # #”

where each of the three #’s is an integer from 0 to 255. We explored the effects of changing these numbers in order to determine what each of the three numbers controlled and how it controlled it.

Here is a screenshot of a program that turns on the red LED within the RGB LED at full intensity:

However, we had a problem. Our program, as currently written, wasn’t all that helpful. Specifically, our program coded only one particular colour — and if we wanted to display another colour, we had to go into the code for the program and make changes there. This wasn’t very user-friendly!

We decided to abstract our program so that the user could display whatever colour they wanted by entering three values for the red, green, and blue intensities.

For the sake of expediency in coding (at the sake of user-friendliness for users who didn’t write the program), we decided to pass these values into the program as formal parameters (i.e. via colour(r,g,b)). We updated our three colour intensity values in the Send “SET COLOR…” line with the variables that represented these colour intensities (r, g, and b)…and quickly figured out that our program didn’t work. Hmmm…

We had a great discussion about what was going on and going wrong here… Specifically, we were sending a string to the Innovator to be translated into visual output. The r, g, and b variables were being read as r, g, and b characters within the string — rather than reading the values these variables actually represented!

No worries, as I knew where this was going. (This is that “knew” thing I was talking about earlier…) I swooped in and saved the day by introducing the eval() command, which evaluates the value of the variable and pastes that into the Innovator string output/send command, instead. Our code now looked like this and worked as intended:

But then…the magic. Someone looked at this problem differently…

T, one of the participants in the room, piped up with “I found another way to do it…! An even more efficient way!” We pulled T’s screen up on the Navigator system and considered his code:

Discussion abounded.

“Wait — doesn’t Send “SET COLOR…” need three values in it?”

“Oh, he’s concatenating with the commas!”

“Don’t we need spaces between the numbers?”

“Could you use ampersands instead?”

“This is like how we used the Disp statement!”

“Wait — does that work?!”

I was surprised by T’s discovery (I had never seen this approach before!) and delighted (of course that works! How fun!). It was a wonderful moment of learning that cemented many ideas we had considered over the course of two days — and provided us with additional flexibility for coding a new command we were just learning to use.

What are your thoughts?

What might the value be in using syntax of Send “SET COLOR eval(r) eval(g) eval(b)” for a program like this?

What might the value be in using syntax of Send “SET COLOR ”,r,g,b ?

What does each method add to our coding arsenal and/or to our understanding of CS topics?

And…is there another way?

Introducing CS with Flowcharts

Toni and I have spent a lot of time over the past year thinking about pedagogical approaches that are effective for introducing CS topics to learners who are new to CS. Also, we’ve thought a lot about how to do this within relatively short learning episodes, such as a 60-minute conference presentation.

Our goal for the end of a 60-minute conference presentation is usually to have participants code out (on a calculator and also (usually) by hand) a rather complicated program — but, more importantly, to have made sense of said program.

In a recent conference session, our goal was for participants to code a program that modeled a back-up sensor on a car, complete with audio feedback based on how far the “car” was away from an object. This particular program (see Toni’s post here for more information) included sequential, branching, and iterative elements, as well as commands related to connecting to, collecting data from, and disconnecting from an actuator (or peripheral device). These are a lot of different elements for someone who is new to CS to integrate!

How might we design learning experiences to support sense-making around these varied commands/structures…in a way that is accessible for new-to-CS learners?

One approach that we have found particularly effective for this work is using flowcharts — specifically, using flowcharts that develop over time. Rather than just jumping right into this rather complicated flowchart (again, complicated for a new-to-CS learner!):

we instead provided the following blank flowchart and had participant pairs brainstorm what commands might need to go into this flowchart (and in what order) in order to read and display a distance measurement from an Ultrasonic Ranger attached to the Innovator.

Note that the task of collecting and displaying a distance measurement is not our end goal, which is to model a back-up sensor — but we deliberately wanted to decompose this program/situation into simpler situations first. In this case, before we model a full-on sensor, how might we code the Innovator just to collect and display a data measurement?

A quick debrief of ideas from the whole group (plus some information from us on what these commands look like for the Innovator) led to this filled-in flowchart:

With a completed flowchart, we quickly “translated” the pseudocode in this flowchart into the programming language of the TI-Nspire and TI-Innovator. Participants checked that their programs collected and displayed a valid distance measurement as intended.

Next, we asked participants to consider, What if we wanted to collect data measurements repeatedly, instead of just once? We provided the following blank flowchart and had participant pairs consider what commands might go in each element of the flowchart.

Participants talked through lots of important ideas here, including: What should go in the “decision diamond”? What commands should happen “outside” of the loop structure? What commands should happen again and again (i.e. inside the loop structure)?

Debriefing these ideas whole-group led to the following completed flowchart:

We quickly coded these additional commands/structures into the program we had started earlier and tested our new programs.

Now, our program collected distance measurements again and again until the distance was less than 0.01 meters. For the sake of our model, we said that this value represented the back-up sensor turning off after a collision — whoops! 🙂

However, our sensor wasn’t giving us very helpful feedback! It was displaying the distances, but who would be reading that display while backing up?! We wanted to add in audio feedback (beeps!) that alerted us if we were nearing an obstacle. Specifically, we wanted there to be two “levels” of audio feedback — warning beeps if we were nearing an object, but then a more urgent set of warning beeps when we got really close to an object.

We provided the following flowchart for participant pairs to discuss:

which led to a final debrief and this filled-in flowchart:

Here we were, finally, at our programmatic goal! We had collectively developed a program (in flowchart form and in coded form in our calculators) that modelled a back-up sensor.

Yes, it took a while to get there, but the time spent sense-making about the earlier situations and flowcharts helped participants develop and use appropriate CS structures and logic while creating this more complex program. We were thrilled with the engagement, discussions, and explanations from our participants, many of whom were new-to-CS learners!

Side Note: When leading this conference session, we ran out of time during the calculator coding of the final part of the program. 😦 We have discussed some time solutions for this for future presentations of this conference session including having participants code the first program on the calculator, but providing “almost complete” versions of parts 2 and 3 already on the calculator. This will cut time out of the session without losing any of the time that focuses on sense-making about the code.

To create these flowcharts we used the LucidCharts Diagrams Chrome extension, which allowed us to create and store these flowcharts in GoogleDrive.

Here’s a copy of our handout from the conference session; we wanted participants to leave with copies of the completed flowcharts so that they could later replicate this work on their own devices.

How else have you used flowcharts to introduce CS topics to new-to-CS learners? What other pedagogical or instructional approaches have been effective for making CS accessible to all?

Michelle Signature

Guest Post by Toni Norrell | Back-Up Sensor using the Ultrasonic Ranger

Another fantastic post from Toni Norrell (@ToniNorrell).

A friend of mine I’ll call Sandy drives a very fancy car! Her car has all the bells and whistles you might say. It has cameras/sensors all the way around that beep a lot. She has a tendency to ignore them when pulling in and out of parking spots because they beep when she is too close to the curb, they beep at the cars parked on either side, they beep if a car drives behind the car, etc. This particular day she ignored the beeps and backed right into a parked car! Like any good friend would, I made her a pillow that says “Respect the Beep.”

Michelle & I started thinking about how this incident could be modeled using the Ultrasonic Ranger & Innovator Hub. We wanted to write a program that was similar to a back-up sensor on a car. This expands upon my previous post about first collecting distance data from the ultrasonic ranger.

  

The program connects the ranger and uses the warm-up program that Michelle talked about in a previous post. The distance variable is initialized and a while loop is setup to read, get, and display the distance as long as it is more than .01 meters.

The If Then looks at distances between 0.1 and 0.5 and sets the hub to send a sound with a particular frequency if the ranger is within that distance.

When the “car” gets closer than 0.1, a higher frequency sound is heard.

We set both of these sounds inside For loops to provide more of the “pulse-like beeping” you often hear from a car’s back-up sensor.

Here is a copy of the complete TNS file for you to try! Also, here’s a short video clip of this program in action:

What other ways could this program have been written?
How could it run even more like a back-up sensor on a car?

Toni Signature

Warm-Up Program for Ranger (with TI-Innovator)

When the Ultrasonic Ranger is first used with the TI-Innovator (or used for the first time in awhile) its first few data measurements might be erroneous. (Toni discussed how to setup and code the Ranger to collect data measurements in this post.)

TI has created a document that outlines a short code segment that can be included in Ranger programs to allow the Ranger to “warm-up” and move through any possible erroneous data measurements. Here is some sample code for this “warm-up”:

Send “CONNECT RANGER 1 TO IN 1 ”

© Use While loop to “warm up” Ranger

d:=−1

While d=−1

Send “READ RANGER 1”

Get d

EndWhile

As Toni explained in this post, the Send “CONNECT RANGER 1 TO IN 1” line of code digitally connects the Ranger to the Innovator–naming the Ranger (in this case, RANGER 1) and telling the Innovator what port the Ranger is connected to (in this case, IN 1).

The While loop (with an initial value of d:=-1 so that the loop will be entered and will run at least once) acts as a “warm-up loop” of sorts that continues to collect and recollect distance measurements (READ from the Ranger and then stored to d) until the distance measurements coming back from the Ranger are positive distances.

Question: Should the code for this “warm-up loop” be explicitly included in all Ranger programs?

This is something Toni and I were thinking about recently when we were planning a 1 hour conference session that explored using the Ranger. We knew that the warm-up loop was an important segment of code to include — otherwise participants might see and be confused by “measured distances” of -1. However, we didn’t want participants–many of whom were completely new to Computer Science–to have to parse out this section of code as well as the rest of the program they would write. The “warm-up loop” was not the focus of our session, but seemed to be a necessary precursor–necessary to run in order to get accurate data; not necessary for participants to have to decipher (at this point).

Toni and I made the decision to write the warm-up block of code in as another program in the file and then call that program within the real program that we were building in the conference session. Here are two screenshots to illustrate the point:

Notice how the backup_sensor program (the program we were building and learning about in the conference session) was sent to participants pre-loaded with three “lines” of code — a line CONNECTing the Ranger, a method call for the warm-up program, and (later) a line DISCONNECTing the Ranger. The blank lines were for inserting the lines of code we developed as a group to code/model a back-up sensor (more on that in a later post).

One of the advantages of this approach? We didn’t lose time analyzing and reasoning through the While “warm-up loop”, but we still gained the benefit of having this warm-up loop running inside our program. This allowed us (as a group) to focus on the coding segments that were particularly relevant to our instructional goal.

One of the disadvantages of this approach? There was less transparency regarding what role the warm-up program was playing–how it worked, why it worked, why it was necessary, etc.. Also, since participants were not coding on their individual calculators, they didn’t leave with a copy of the warm-up program/code in case they wanted to use it later. One solution to this might be to distribute a copy of the document created by TI at the end of the session.

What do you think? What are the pros and cons of making the warm-up program explicit and/or “hiding” it instead? When might you make this code segment explicit? When might you “hide” it?

Michelle Signature

Guest Post by Toni Norrell | Getting Started with the Ultrasonic Ranger (with the Innovator Hub)

A great post from Math & Computer Science guru Toni Norrell (@ToniNorrell).

Michelle & I wanted to explore using the Ultrasonic Ranger with the Innovator Hub for a presentation we were putting together. We started off by focusing on the syntax needed to connect the ranger to collect a distance measurement. This consisted of several lines of code in the screenshot shown below.

Send “CONNECT RANGER 1 TO IN 1” is the initial code that connects the ranger (named RANGER 1) to the hub digitally. Physically, the ranger is connected in the port IN 1 on the side of the Innovator hub. The commands Send “CONNECT RANGER are found under the hub menu (Send “CONNECT -Input), TO is found in the hub menu under settings, and IN 1 is found under the hub menu and Ports.

Once the ranger is connected, we want to send a command to read this device called RANGER 1 using the command Send “READ RANGER 1” . The “READ” command tells the Ranger to “read” the distance at that particular instance in time. So far, we have connected the ranger, and read the ranger, but we haven’t done anything with that reading. Our next statement Get distance, will actually get the reading and then store it in a variable named distance. Of course, we won’t see this value unless we use the display command to show us the output: Disp distance. Note: The display command is not necessary for the data collection to work, however, it is a nice feature that allows us to get that visual check to see if our program is recording and saving distances.

It is good practice to use the last line of code which is Send “DISCONNECT RANGER 1” which is found under the hub menu. On the next post, Michelle will address the warm_up() statement in the code.

Here’s a short video showing this program in action. Also, you can download a copy of the TNS file for this short program.

Toni Signature

 

What the Flipped Class Allows Us To Do

Earlier this week I learned from Aaron Sams and Jonathan Bergmann in their “Flipped Classroom” webinar hosted by Classroom 2.0 LIVE. I shared some of my earlier reflections from this webinar in previous posts (re: Algebra II and Anatomy).

At one point in the webinar, Aaron began discussing the Flipped-Inquiry model, as shown in the figure above. I have been using the 5E lesson model for the last two years as part of the curriculum my district has adopted (while I was an early skeptic, I am a huge believer now!). It was exciting to see that other teachers are using flipped instruction and the 5E model! There is certainly no “one way” to flip your classroom — the flipped inquiry model shown above is just one of many. However, it’s a great starting point for me, because I am comfortable with (and confident in) the 5E model — flipping from this framework allows me to start where I’m at and explore new instructional strategies from a familiar home base.

Another idea that struck me in the webinar came from Aaron’s discussion of Bloom’s Taxonomy, as applied to the flipped classroom. The lower levels of this taxonomy (namely remembering and understanding) can often be taught/learned through instructional videos. I would certainly agree with this as it applies to both of my flipped classes — Algebra II and Anatomy/Physiology. The value of the videos, then, is not acquisition of basic skills (remembering and understanding); rather, the value of the videos is the transition of this low-level thinking out of our precious, limited class time, so that we can use this time for much more valuable higher-order thinking skills (analyzing, evaluating, and creating). I have seen this in action in my classes and this is the heart (and value!) of the flipped classroom — the opportunity to go further and deeper through more meaningful and important activities…in class!

Aaron and Jonathan shared the slide above, showing how the flipped classroom actually allows for the inversion of the typical Bloom’s Taxonomy pyramid. Using the flipped model, we spend more time creating, evaluating, and analyzing — definitely a teacher’s dream! In the past, I had always wanted to incorporate more of these activities, but we spent so much class time learning initial content (lower levels) that there “wasn’t time” for the synthesis and evaluation activities I wanted to do. The flipped model has definitely helped me find the time!

Next steps for me include further developing my in-class activities to create even more solid, rich learning tasks at these higher levels. This is definitely a good problem to have — I now have all of this class time with initial content understanding, so what valuable learning activities can we tackle?

***

What do you think? What are some ways that you create time for creation, evaluation, and analysis in your lesson cycle?

What is the Best Use of Our Class Time — Algebra II Version

As discussed in a previous post, Jonathan Bergmann and Aaron Sams have me thinking — which is a great thing! This post is a continuation of the discussion “What is the best use of your class time?” or “What part of the learning cycle do my students most need face-to-face time with me?“, as these questions apply to my flipped Algebra II class. Here are some thoughts:

Algebra II

I think the best use of our class time in Algebra II varies based on our position in a lesson cycle. We are following a 5E lesson model in our math classes, with great effectiveness.

Early in the lesson cycle (say during “Engage” and “Explore” activities), I believe our class time is best spent working through these activities (usually self-directed group work) and then discussing our findings/results/epiphanies. Some of the initial parts of these activities can be introduced with short instructional videos, opening up more class time to really analyze and synthesize the results of the exploration.

So far, the “Explain” piece has been effectively broken into “lecture” portions (delivered outside of class via short instructional videos — some examples here), followed by class time spent practicing these new skills. To specifically answer the question posed in the webinar, I think my class time during the “Explain” phase is best spent helping students fine-tune their skills via practice rather than direct content delivery.

During the “Elaborate” cycle, I think our class time is best spent on application of the material to new and engaging problems. This usually involves group work, projects, more challenging examples, modeling real-world applications, etc.. Thankfully, I have a wealth of these opportunities at my fingertips, thanks to great modeling applications in our textbook resources, Vernier’s Video Physics app, and Dan Meyer’s brilliance.

As per the “Evaluate” portion, this is currently broken into two different opportunities — “performance indicator” tasks where students apply, describe, and communicate their learning in an extended way (a great use of class time, in my opinion — see an example below), and the more traditional assessments (quizzes/tests). Currently, all tests and quizzes occur during class time under my careful watch — BUT, is this the best use of our class time? Do students most need face-to-face time with me for this part of the lesson cycle? I’m not sure… I would like to transfer this part out of my precious class time (since I don’t think they really need me for this)—but, how to do this in a way that still maintains the integrity of the assessment? This is something I am still thinking about… Please share your thoughts!

What do we do with all the extra class time?

This is the other question from Jon and Aaron’s webinar that really had me thinking. I think I’m on the right track here in Algebra II. Currently, we do a lot more applications, modeling, math projects, and reflective thinking (currently loving the use of PollEverywhere, as do my students!), than we were doing before. Also, I’m able to spend much more time with students who really need the help, which is a huge bonus. I also think that I will be able to easily incorporate great extension activities for students who are working through the content at a faster pace.

I am excited about the progress and possibilities for my flipped Algebra II class!

***

What do you think? In what part of the learning cycle do you think your students most need face-to-face time with you?