Analog Out
In this lab, I focused on sending values from IFTTT to the Micro:Bit. To do this, I created an Applet on IFTTT that will receiving my tweet from X (formally twitter) and send it to my Adafruit Webhook. Using a flask server running on my laptop, I then used a HTML scraping tool called selenium to get the newest data from my Adafruit dashboard and displaying this on a flask servers webpage.
What is AdaFruit
"Adafruit was founded in 2005 by MIT engineer, Limor "Ladyada" Fried. Her goal was to create the best place online for learning electronics and making the best designed products for makers of all ages and skill levels. "
- https://www.adafruit.com/about
Adafruit IO is a platform designed by Adafruit to display, respond, and interact with your project's data.
What is HTML Scraping (Selenium)
"The modern web is becoming increasingly complex and reliant on JavaScript, which makes traditional web scraping difficult. Traditional web scrapers in python cannot execute JavaScript, meaning they struggle with dynamic web pages, and this is where Selenium - a browser automation toolkit - comes in handy!"
- https://scrapfly.io/blog/web-scraping-with-selenium-and-python/
Selenium is a tool that allows you to scrape dynamically loaded web pages for information.
Creating Applet
Setting Up "This"
I set up the Twitter trigger. To do this, I needed to log into my twitter account for IFTTT to be able to listen for my new tweets.
Setting up "That"
I then created an Adafruit account so that I could display my new tweets in a dashboard. I logged into Adafruit and selected the feed I wanted to send the data to along with the data I wanted to send.
Creating Adafruit IO Feed
Above is a screenshot of my Adafruit dashboard. To set up the 'X' feed, I selected "New Feed" and gave it a name. Once this was completed, I could select the feed on IFTTT and begin sending data to Adafruit IO.
Dashboard
Demonstration of the Pipeline
1. Posting on Twitter
2. Receiving data to Adafruit
The text can be seen as delivered to the Adafruit feed along with a timestamp.
3. HTML scrape using flask server
Next, the flask server uses selenium (HTML scraping tool) to retrieve the latest data, I achieve this by highlighting the text I wanted to search for and looked at its class name in the inspector. This gave me the information I needed to tell the HTML scraping tool what element to look for.







Comments
Post a Comment