The IoT Starter Pack includes the following hardware blocks: Superbase, Serial, I/O Expander, USB Keyboard/Mouse, Audio, and Wifi. It also ships with a light level sensor (TSL2561), a eight RGB LED strip (Neopixel), and a push button. The light level sensor is connected to the I2C interface on the Serial hardware block. The RGB LED strip is connected to the SPI interface on the Serial hardware block. The push button is connected to the first input interface screw terminal on the I/O Expander hardware block.
There is an example project in the “Projects” Tab of Stackbuilder, in the “Demo Projects” category. Click once on the “Demo Projects” category name to expand it. You can then double click on any project to open it. The “Light Sensor to LEDs” project is a good starter project. It changes the RGB LED strip based on the light level sensor. You can make a copy of this project using the “Action” menu in the “Projects” tab and then make any modifications you want. To modify existing software blocks in the project, you will need to select the existing block, then select the Copy icon to make a copy of it. You must then connect the channels to your copy, then delete the original.
If you want to create a new project from scratch using the accessories, you will need to set some hardware block properties in Stackbuilder. To set properties in Stackbuilder: Select the block by clicking on it once. Click in the “Property Editor” in the bottom right, in the first row, in the “Property” column. Type the property name (without quotes). Click in its corresponding “Default Value” column and type the value to set (if a character or string, use quotes).
To use the RGB LEDs, set the “L” property in the Serial block to 2. After doing this, you can simply send character strings to the SPI Send input terminal of the Serial block to set the colors of the RGB LEDs in the chain. For example, ‘rrrrrrrr’, to set 8 LEDs to all red. Each character is interpreted as a color: r-red o-orange y-yellow g-green b-blue m-magenta p-purple c-cyan z-brown w-white x-clear (off). There should be a color for each LED position in the chain (8 total). Characters can be upper or lower case.
Light level sensor values will be sent out of the “I2C Auto Receive” output terminal when any message is sent to the “I2C Auto Request” input terminal.
For the pushbutton, set property 1 of the I/O Expander block to the value 3 (digital input, send on change). As the button is pressed and released, the characters “0” and “1” will be sent out of the “Out 1” output terminal.
You can also refer to the support documents for the individual hardware blocks.
Example Blueprint to change RGB LEDs based on light sensor
Software block – PY Light LEDs
Refer to documentation on many other topics at interstacks.com/knowledge-base.
Please email email@example.com with any questions.