TI Hub Menu
Note: When creating a new program that uses this module, it is recommended to use the Hub Project program type. This will ensure that all the relevant modules are imported.
Item |
Description |
---|---|
from ti_hub import * |
Imports all methods from the ti_hub module. |
Hub Built-in Devices > Color Output
Item |
Description |
---|---|
rgb(red,green,blue) |
Sets the color for the RGB LED. |
blink(frequency,time) |
Sets the blinking frequency and duration for the selected color. |
off() |
Turns the RGB LED off. |
Hub Built-in Devices > Light Output
Item |
Description |
---|---|
on() |
Turns the LED on. |
off() |
Turns the LED off. |
blink(frequency,time) |
Sets the blinking frequency and duration for the LED. |
Hub Built-in Devices > Sound Output
Item |
Description |
---|---|
tone(frequency,time) |
Plays a tone of the specified frequency for the specified time. |
note("note",time) |
Plays the specified note for the specified time. The note is specified using the note name and an octave. For example: A4, C5. The note names are C, CS, D, DS, E, F, FS, G, GS, A, AS, and B. The octave numbers range from 1 to 9 (inclusive). |
tone(frequency,time,tempo) |
Plays a tone of the specified frequency for the specified time and tempo. The tempo defines the number of beeps per second ranging from 0 to 10 (inclusive). |
note("note",time,tempo) |
Plays the specified note for the specified time and tempo. The note is specified using the note name and an octave. For example: A4, C5. The note names are C, CS, D, DS, E, F, FS, G, GS, A, AS, and B. The octave numbers range from 1 to 9 (inclusive). The tempo numbers range from 0 to 10 (inclusive). |
Hub Built-in Devices > Brightness Input
Item |
Description |
---|---|
measurement() |
Reads the built-in BRIGHTNESS (light level) sensor and returns a reading. The default range is 0 to 100. This can be changed using the range() function. |
range(min,max) |
Sets the range for mapping the readings from the light level sensor. If both are missing, or set to a value of None, then the default brightness range of 0 to 100 is set. |
Add Input Device
This menu has a list of the sensors (input devices) supported by the ti_hub module. All the menu items will paste the name of the object and expect a variable and a port used with the sensor. Each sensor has a measurement() method that returns the value of the sensor.
Item |
Description |
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DHT (Digital Humidity & Temp) |
Returns a list consisting of the current temperature, humidity, type of sensor, and last cached read status. |
|||||||||||||||||||||||||||
Ranger |
Returns the current distance measurement from the specified ultrasonic ranger.
|
|||||||||||||||||||||||||||
Light Level |
Returns the brightness level from the external light level (brightness) sensor. |
|||||||||||||||||||||||||||
Temperature |
Returns the temperature reading from the external temperature sensor. The default configuration is to support the Seeed temperature sensor in IN 1, IN 2 or IN 3 ports. To use the TI LM19 Temperature sensor from the TI-Innovator™ Hub breadboard pack, edit the port to the BB pin in use and use an optional argument "TIANALOG". Example: mylm19=temperature("BB 5","TIANALOG") |
|||||||||||||||||||||||||||
Moisture |
Returns the moisture sensor reading. |
|||||||||||||||||||||||||||
Magnetic |
Detects the presence of a magnetic field. The threshold value to determine the presence of the field is set through the trigger() function. The default value of the threshold is 150. |
|||||||||||||||||||||||||||
Vernier |
Reads the value from the Vernier analog sensor specified in the command. The command supports the following Vernier sensors:
|
|||||||||||||||||||||||||||
Analog In |
Supports the use of analog input generic devices. |
|||||||||||||||||||||||||||
Digital In |
Returns the current state of the digital pin connected to the DIGITAL object, or the cached state of the digital output value last SET to the object. |
|||||||||||||||||||||||||||
Potentiometer |
Supports a potentiometer sensor. The range of the sensor can be changed by the range() function. |
|||||||||||||||||||||||||||
Thermistor |
Reads thermistor sensors. The default coefficients are designed to match the thermistor included in the Breadboard Pack of the TI-Innovator™ Hub, when used with a 10KΩ fixed resistor. A new set of calibration coefficients and reference resistance for the thermistor can be configured using the calibrate() function. |
|||||||||||||||||||||||||||
Loudness |
Supports sound loudness sensors. |
|||||||||||||||||||||||||||
Color Input |
Provides interfaces to an I2C-connected Color Input sensor. The bb_port pin is used in addition to the I2C port to control the LED on the color sensor.
The numbers represent the colors per the following mapping: 1: Red 2: Green 3: Blue 4: Cyan 5: Magenta 6: Yellow 7: Black 8: White 9: Gray
|
|||||||||||||||||||||||||||
BB Port |
Provides support for using all 10 BB port pins as a combined digital input/output port. The initialization functions have an optional "mask" parameter that allows the use of the subset of the 10 pins.
|
|||||||||||||||||||||||||||
Hub Time |
Provides access to the internal millisecond timer. |
|||||||||||||||||||||||||||
TI-RGB Array |
Provides functions for programming the TI-RGB Array. The initialization function accepts an optional "LAMP" parameter to enable a high-brightness mode for the TI-RGB Array that requires an external power supply.
|
Add Output Device
This menu has a list of the output devices supported by the ti_hub module. All the menu items will paste the name of the object and expect a variable and a port used with the device.
Item |
Description |
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
LED |
Functions for controlling externally connected LEDs. |
|||||||||
RGB |
Support for controlling external RGB LEDs. |
|||||||||
TI-RGB Array |
Provides functions for programming the TI-RGB Array. |
|||||||||
Speaker |
Functions for supporting an external speaker with the TI-Innovator™ Hub. The functions are the same as the ones for "sound" above. |
|||||||||
Power |
Functions for controlling external power with the TI-Innovator™ Hub.
|
|||||||||
Continuous Servo |
Functions for controlling continuous servo motors.
|
|||||||||
Analog Out |
Functions for the use of analog input generic devices. |
|||||||||
Vibration Motor |
Functions for controlling vibration motors.
|
|||||||||
Relay |
Controls interfaces for controlling relays.
|
|||||||||
Servo |
Functions for controlling servo motors.
|
|||||||||
Squarewave |
Functions for generating a square wave.
|
|||||||||
Digital Out |
Interfaces for controlling a digital output.
|
|||||||||
BB Port |
Provides functions for programming the TI-RGB Array. See the details above. |
Commands
Item |
Description |
---|---|
sleep(seconds) |
Pauses the program for the specified number of seconds. Imported from the 'time' module. |
text_at(row,"text","align") |
Displays the specified "text" in the plotting area at specified "align". Part of the ti_plotlib module. |
cls() |
Clears the Shell screen for plotting. Part of the ti_plotlib module. |
while get_key() != "esc": |
Runs the commands in the "while" loop until the "esc" key is pressed. |
get_key() |
Returns a string representing the key pressed. The '1' key returns "1", 'esc' returns "esc", and so on. When called without any parameters - get_key() - it returns immediately. When called with a parameter - get_key(1) - it waits until a key is pressed. Part of the ti_system module. |
Ports
These are the input and output ports available on the TI-Innovator™ Hub.
Item |
---|
OUT 1 |
OUT 2 |
OUT 3 |
IN 1 |
IN 2 |
IN 3 |
BB 1 |
BB 2 |
BB 3 |
BB 4 |
BB 5 |
BB 6 |
BB 7 |
BB 8 |
BB 9 |
BB 10 |
I2C |