TI-Innovator™ Hub with Python Commands

Use the menus for the TI Hub module (“ti_hub”) to create or edit a program. They can save you time building commands and help you with correct command spelling and syntax.

When you see "Python Code Sample" in a command table, this "Python Code Sample" may be copied and pasted as is to send to your graphing calculator to use in your calculations.

Example:

Python
Code
Sample:

light.on()

light.off()

sound.tone(440,4)

b = brightness.measurement()

print(b)

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.

NOTE: The Python commands are identical on the CE calculators and TI-Nspire™ CX II. However, on the CE products, each of the sensor and external devices has its own module.

Screenshots are provided for reference. Note: Actual menus may vary slightly from provided images.


TI-HUB Menus

• Hub Built-in devices

CE Calculators

TI‑Nspire™ CX


Built-in Menus

– Color
– Light
– Sound
– Brightness

CE Calculators

TI‑Nspire™ CX


Input Menus

• Hub Input devices

CE Calculators

TI‑Nspire™ CX


Input DHT

– var = dht("port", "opt")
– var.temp_measurement()
– var.humidity_measurement()
– var.t_h_measurement()

CE Calculators

TI‑Nspire™ CX


Input Ranger

– var=ranger("port")
– var.measurement()

Input LightLevel

– var=ranger("port")
– var.measurement()
– var.range(min,max)

Input Temp

– var=temperature("port")
– var.measurement()

Input Moisture

– var=moisture("port")
– var.measurement()
– var.range(min,max)

Input Magnetic

– var=magnetic("port")
– var=magnetic_close()
– var.measurement()
– var.trigger(level)

 

Input Vernier

– var=vernier("port","type")
– var.measurement()
– var.calibrate(a,b)
– var.calibrate(a,b,c,r)

 

Input Analog In

– var=analogin("port")
– var.measurement()
– var.range(min,max)

 

Input Digital In/Out

– var=digital("port")
– var.measurement()
– var.set(val)
– var.off()
– var.on()

 

Input Potentiometer

– var=potentiometer("port")
– var.measurement()
– var.range(min,max)

 

Input Thermistor

– var=thermistor("port")
– var.measurement()
– var.calibrate(c1,c2,c3,r)

 

Input Loudness

– var=loudness("port")
– var.measurement()
– var.range(min,max)

 

Input Color Input

– var=color_input("bb_port")
– var.color_number()
– var.red()
– var.green()
– var.blue()
– var.gray()

 

Input BB Port (Breadboard Port)

– var=bb_port("mask")
– var.read_port()
– var.read_port(mask)
– var.write_port(value)
– var.write_port(value, mask)

 

Input Hub Time

– var=hub_time()
– var.measurement()
– var.reset_time()

 

Input TI-RGB Array

– var=rgb_array()
– var.set(led_position, red, green, blue
– var.set_all(red, green, blue
– var.all_off()
– var.pattern(value)
– var.measurement()

 

Output Menus

• Hub Output devices

CE Calculators

TI‑Nspire™ CX

 

Output LED

– var=led("port")
– var.off()
– var.on()
– var.blink(freq,time)

CE Calculators

TI‑Nspire™ CX

 

Output RGB

– var=rgb("port")
– var.rgb(r,g,b)
– var.blink(freq,time)
– var.off()

CE Calculators

TI‑Nspire™ CX

 

Output Speaker

– var=speaker("port")
– var.tone(freq,time)
– var.note(“note”,time))

CE Calculators

TI‑Nspire™ CX

 

Output Power

– var=power("port")
– var.set(value)
– var.off()
– var.on()

CE Calculators

TI‑Nspire™ CX

 

Output Continuous Servo

– var=continuous_servo("OUT 3")
– var.set_cw(speed,time)
– var.set_ccw(speed,time)
– var.stop()

CE Calculators

TI‑Nspire™ CX

 

Output Analog Out

– var=analog_out ("port")
– var.set(value)
– var.off()
– var.on()

CE Calculators

TI‑Nspire™ CX

 

Output Vibration Motor

– var=vibration_motor("OUT 3")
– var.set(value)
– var.off()
– var.on()

CE Calculators

TI‑Nspire™ CX

 

Output Relay

– var=relay("OUT 3")
– var.off()
– var.on()

CE Calculators

TI‑Nspire™ CX

 

Output Servo

– var=servo("OUT 3")
– var.set_position(pos)
– var.zero()

CE Calculators

TI‑Nspire™ CX

 

Output Squarewave

– var=squarewave("port")
– var.set(freq,duty,time)
– var.off()

CE Calculators

TI‑Nspire™ CX

 

Output Digital in|out

– var=digital("port")
– var.measurement()
– var.set(value)
– var.off()
– var.on()

CE Calculators

TI‑Nspire™ CX