Hey Michael!
I don't have an example of this kind of device, but the approach I'd take is pretty simple:
- Create a Device subclass that handles basic interaction with the teensy (for example, it will have a method that immediately sends a serial command)
- Create a DeviceTask subclass that accepts a configuration structure like:
{'commands': [(start_time, command), (start_time, command), ...]}
- Write TeensyDevice.createTask() to return an instance of your TeensyDeviceTask
- When your TeensyDeviceTask.start() method is called, store the current time and start a background thread that sends each command at the appropriate time
One thing to be careful of here is that you will be sending serial commands from a background thread, so it's important to use a mutex to prevent multiple threads accessing the serial port at the same time.
Does that all make sense? I can go into more detail..
Cheers,
Luke