Part 1 covered hardware assembly, part 2 covered accessing the Splunk API using PowerShell, so now it’s time to complete this project. To do so, we need a script to send commands to the USB controller and a “driver” script to loop and call the PowerShell script that communicates with the Spunk API and the one that sends commands to the USB controller.
There’s a great example available on the Teensy website that demonstrates using PowerShell to communicate with the Teensy. My SendSerialCommand.ps1 is partly based on this example.
Script: SendSerialCommand.ps1
Since we want the LED meter to continually update, I created another PowerShell script that’s in charge of calling SplunkSearchGauge.ps1 and SendSerialCommand.ps1; this script is considered the “driver” and will be the one you launch from the PowerShell terminal.
Script: Main.ps1
Finally, if you’re interested in testing the LED light strip, this script will light up each light from 1-32 and then turn them back off from 32-1.
Script: TestGauge.ps1



