My desk at work has been a bit lacking as far as holiday decorations go. With a spare Raspberry Pi and a blink(1) dongle, I decided to connect my Christmas light to the world of streaming data! By polling the Twitter API, I could get a signal each time someone tweets with #Christmas. This signal is then used to change the color of the dongle, letting me "see" people talk about Christmas!
The ServiceThe nio service running on the Raspberry Pi instance is super simple. Three nio blocks come together to create all of the functionality of this project.
Starting with the Twitter Block the stream is started. The block is configured with my Twitter credentials and I set up the query to get all "#Christmas" tweets.
This leads to the Counter Block which holds a cumulative count of all signals that pass through it. This cumulative count is passed through the output terminal of the block.
Finally there is the Blink1 Block which takes the cumulative count and changes the RGB color depending on the cumulative count being even or odd. The configuration of the Blink1 block can be seen below using the nio expression syntax.
Comments
Please log in or sign up to comment.