Home STEM HQ TI-Nspire Authoring TI-Nspire Scripting HQ Scripting Tutorial - Lesson 48

           


Scripting Tutorial - Lesson 48: Lua Scripting and the TI Innovator™ Hub:

8. Create a general Innovator™ Hub Document



Download supporting file for this tutorial

Texas Instruments TI-Nspire Scripting Support Page

       
  

Scripting for the Innovator Hub: Lesson 8: Create a general Innovator™ Hub Document

Top of Page

The previous example documents have been deliberately simplified in terms of user interface - just a point and click interaction, to make it easier to focus on the new Innovator Hub code.

Now it is time to generalise that interface and to allow the user to make changes and explore and experiment with the Innovator coding commands. This is easily achieved by simply using an interactive text box.

  

 
    
  1. Define the textbox and a short help text to initially go into it.

    Add text to the inBox for the various sample actions in the menu.

  2.   
      

  3. Here we set up our inBox.
  4.   
      

  5. The heavy lifting in this script lies in the tabKey function. We need to allow for those occasions when the user might want to include multiple send statements, and have these dealt with individually.

    Pay particular attention to the application of the little known Lua command loadstring. If a line in the inBox begins with SET, or READ or CONNECT, then it will be sent more or less directly to the Innovator for processing.

    If not, then if that command is a valid Lua function defined in your script (such as blink, or wait, etc) then it will attempt to carry out that command. This is very powerful and opens to the doors to many interesting applications.

  6.   
      
  7. No changes from that previously defined.

  8.   
      

  9. As previously defined.

  
     
 
 

 
 

We can put together much that has gone before and offer a glimpse of ways in which the Innovator Hub might prove a valuable tool within traditional lessons for building strong foundations for understanding and concept development.

The practical applications of sensors which measure distance, of course, are well established at all levels of schooling, from very young students (using bodily movement to build shapes and letters) through junior high school (where personal movement can be linked to key concepts such as gradient) and through to seniors (applied to velocity, rates of change and even a deeper understanding of the various functions which are the objects of study for so much of mathematics). The ability to use an ultrasonic motion sensor with our Innovator Hub invites all of these applications and more.

Other sensors prove valuable in building, not only STEM skills and understandings, but deep and rich mathematical and scientific ones. Consider for example, the in-built brightness sensor on the Hub. Practical questions such as Could a light sensor be used as a measure of distance from the light source?.

This is a question about calibration at its heart - but just as much it may be a question about linear relationships (a linear model is actually quite accurate over a distance of 1 - 2 metres), or more interesting functions for older students - What do students know about light intensity and its relationship to distance from the source? (science)

How might their readings be calibrated and converted: changing light intensity to metres?

Can you account for observed differences?

How might the most effective exploration be designed?

How accurate is the data they collect? How might they validate this?

The same questions might be applied to the use of barometric pressure as a measure of altitude - and how might a magnetometer serve as a compass?

The study of movement in all its forms comes alive when collecting data using an accelerometer - distance, velocity and acceleration become physical to students when their own motion generates immediate responses. Linking this motion to different functions then brings these functions to life, leading to deeper understanding.

Simple, personal applications are readily found: Where is the best place to sit in the classroom?

Like most of the best STEM-active questions, the answer is ... It depends!

Some people feel the cold more than others, and like to sit near a heater. For others, they want to be as far away from the heat source as possible. Some like to sit where the light is bright. There are numerous factors that determine our preferences, and these can be easily explored using the Innovator Hub to grab the readings at different points around the room.

This can even be set as a game challenge. In the past, I would go into the room before the students and collect temperature and light data from several points, then display the graph to the students and ask them to decide where these spots are located! It offers a fun and worthwhile challenge and is immediately applicable to building graph sense and interpretation skills.

In the final example shown, a rotary angle sensor is connected to OUT1, and read simply as ANALOG.IN 1 (a potentiometer could have been used just as easily). Values for the range of turns vary from 0 to 15864. These values may be eeasily converted to something more accessible - say values from -5 to 5 by grabbing the last value of the dataList list - and used to control the gradient of a straight line as shown (or the y-intercept, or any other relevant variable).

You may also notice the use of the wait function here to give time for the student to move to the graphs page and to explore changing values for the gradient.

Students then may control the gradient by turning the rotary angle sensor and explore the different effects, building a very concrete understanding of the concept under investigation. Even the calculation of the conversion factor required offers a lovely application of linear functions!

Applying the Innovator Hub to the Traditional Curriculum:
Bringing Mathematics and Science to Life
by Putting It into the Hands of Students

In our next lesson, we combine Innovator Hub scripting with BLE to develop general scripts that will work on all our TI-Nspire platforms.


  

Back to Top

  

Home STEM HQ TI-Nspire Authoring TI-Nspire Scripting HQ Scripting Tutorial - Lesson 48