Hub Programming on TI‑Nspire™ CX Technology

Note: These instructions apply to TI‑Nspire™ CX technology. For similar instructions for TI CE graphing calculator, refer to Hub Programming on TI CE Graphing Calculator (here).

The TI‑Innovator™ Hub responds to TI Basic programming commands such as Send and Get.

Send - Sends command strings to the Hub to control devices or request information.
Get and GetStr - Retrieve information requested from the Hub.
eval() - Supplies the result of an expression as a character string. Valid only within Send, Get, and GetStr commands.
Wait - Pauses program execution for a specified number of seconds.

Code Examples: TI-Nspire™ CX Technology

Desired Action

Program Code

Turn on the on-board Red LED ("LIGHT").


Play a 440Hz tone on the on-board speaker ("SOUND") for 2 seconds.

Send "SET SOUND 440 TIME 2"

Turn on blue element of on-board RGB LED ("COLOR") at 100% brightness.


Read and display the current value of the on-board light sensor ("BRIGHTNESS"). Range is 0% to 100%.

Get a: Disp a


Sample Program to Blink an On-Board LED

The following TI‑Nspire™ CX program uses the Send and Wait commands to blink the on-board red LED in the Hub. The commands are contained in a "For...EndFor" loop that repeats the ON/OFF blink cycle for 10 iterations.

Define blink()=
For n,1,10
Wait 1
Wait 1

How to Create and Execute a Program

Note: These are abbreviated instructions. For detailed instructions, refer to the TI‑Nspire™ CX Program Editor.

Before You Begin:

Refer to System Requirements (here), and update your software as needed.
- On TI‑Nspire™ CX handhelds, use TI‑Nspire™ computer software to update the Operating System.
- On computers running TI‑Nspire™ CX software, use the Help menu to update the software.

To Create a New Program in a TI‑Nspire CX Document:

1. On the handheld, press ~ and select Insert > Program Editor > New.
From the computer software, click Insert > Program Editor > New.
2. Type a name for your program, such as "soundtst," select Program as the Type, and then click OK.

The Program Editor opens, displaying a template for your program code.

3. Between the Prgm and EndPrgm lines, type the lines of code that make up your program.
- You can either type command names or insert them from the Program Editor menu.
- After typing each line, press Enter to type additional code.
- Use the arrow keys to scroll through the program.

To Store the Program:

You must store your program before you can run it.

On the handheld, press b and select Check Syntax & Store > Check Syntax & Store.
On the Program Editor menu, click Check Syntax & Store > Check Syntax & Store.

To Close the Program Editor

On the handheld, press b and select Actions > Close.
On the Program Editor menu, click Actions > Close.

If you have made changes since storing the program, you are prompted to Check Syntax & Store.

To Run the Program:

1. Ensure that the TI‑Innovator™ Hub is connected to your handheld or computer.
2. Ensure that any needed I/O Modules or Breadboard components are connected to the Hub.
3. Open the document that contains the program.
4. On a Calculator page, type the program name and parentheses. If the program requires arguments, enclose them in the parentheses, separated by commas.

The program runs.

To Edit an Existing Program:

1. If necessary, open the document that contains the program.
2. Go to a Calculator page.
3. On the handheld, press b and select Functions & Programs > Program Editor > Open.
On the Calculator menu, click Functions & Programs > Program Editor > Open.
4. Select the program name name from the displayed list.

The program appears in a Program Editor page.

Using the Hub Menu to Build Commands

The Hub menu is available on the TI‑Nspire™ CX technology anytime you are creating or editing a program. It can save you time building commands and help you with correct command spelling and syntax.

Note: To build a command from the Hub menu, you need to know:

The unique name of the component that you are addressing, such as "SOUND" for the on-board speaker.
The command parameters that apply to the component, such as sound frequency and duration. Some parameters are optional, and you might need to know the value range of a parameter.

Example of Using the Hub Menu:

This TI‑Nspire™ CX example builds the command Send "SET SOUND 440 TIME 2" to sound a 440Hz tone for 2 seconds on the on-board speaker.

1. Open (or create) the program that you will use to communicate with the Hub.
2. Position the cursor where you want to place the command.
3. On the handheld, press b and select Hub.
In the Program Editor menu, select Hub.

The Hub menu appears.

4. Select Send "SET, and then select SOUND to insert the first part of the command.

5. Type 440 as the frequency value.

6. On the Hub menu, select Settings > TIME.

7. To complete the command, Type 2 as the TIME value.

8. To test the command, follow the previous instructions for running a program.

Tips for Coding with TI‑Nspire™ CX Technology

Code from an external source might contain "curly" quotation marks (...) in places that require straight quotes ("..."). To type straight quotes, press / r.
To clear the current line of code, press / Ì.
To type relational operators such as =, <, and , press / =.
To type a space, press _.
If your program becomes unresponsive while running:

TI‑Nspire™ CX Handheld: Hold down the c key and press · repeatedly.
Windows®: Hold down the F12 key and press Enter repeatedly.
Mac®: Hold down the F5 key and press Enter repeatedly.