Home ← TI-Nspire Authoring ← TI-Nspire Scripting HQ ← Scripting Tutorial - Lesson 30
Scripting Tutorial - Lesson 30: Welcome to Bluetooth (BLE)
Supplement: Working with Scripts on the iPad
Lesson 31: BLE - BLE - Create your own TI-Nspire Remote
Lesson 33: BLE - Measuring Heart Rate
Lesson 34: BLE - Measuring Temperature with the TI Sensor Tag
Lesson 35: BLE - Build Your Own Weather Station with the TI Sensor Tag
Lesson 36: BLE - Exploring Movement and Position with the TI Sensor Tag
Lesson 37: Lua, LaunchPads and BLE: Making Music via BLE
Lesson 39: Lua, LaunchPads and BLE: Build your own BLE Robot for under $USD40
Download supporting files for this tutorial
Download this page in PDF format
Texas Instruments TI-Nspire Scripting Support Page
BLE (Bluetooth Low Energy or Bluetooth Smart) has been available on computers and personal devices for some years now, and TI-Nspire Lua for iPad (version 3.11.x) is now BLE-capable. We can now create scripts that will recognise and collect data from a range of BLE devices - from temperature to heart rate, and many more. This can provide a bountiful source of real world data for students at all levels, for many STEM applications.
Scripts can also be written to send commands to BLE devices, making possible a wide range of robotics and physics activities.
The tutorials in this series will take you step-by-step through the process of building BLE-active documents. Obviously, you will need two key pieces of equipment - a BLE-capable iPad (any iPads except the original iPad and the iPad 2) and a BLE probe or device.
The main device used here will be the TI Sensor Tag, an inexpensive ($USD25) robust tool which packs SIX probes - temperature (both ambient and target), humidity, barometer, accelerometer, magnetometer and gyroscope! We will also feature the Vernier Go Wireless Temp probe, and the RHYTHM+ heart rate monitor.
But for a quick and easy start and a wealth of BLE-based opportunities, it is hard to go past the TI Sensor Tag, which can be ordered online from Texas Instruments, wherever you are in the world.
Click anywhere on this image for a video demonstration
Getting Started with BLE
The process of writing Lua code to work with BLE involves several steps. The required source is obtained by calling bleCentral: in the same way that we use
require 'color', for BLE use:pcall(function () require 'bleCentral' end)
Since most devices do not have BLE capabilities, note the use of 'pcall' here - this is a 'protected call' that will try that command and ignore any errors that might arise.
-- Check that the current device is BLE capable and BLE ready
-- Scan for detectable BLE sources (peripherals)
-- If a peripheral (or more than one peripheral) is found, try to establish a connection
-- If a connection is established, take and use data from that link
Sounds simple enough, doesn't it?
|
|
Home ← TI-Nspire Authoring ← TI-Nspire Scripting HQ ← Scripting Tutorial - Lesson 30