Hey… Im completely new to the Imp, and coding it, but I know that Bud uses it in their hockey red lights, and I’m looking to make something similar, but for baseball… where the code would go check a website to see if a run was scored for a specific team, and if there was a run, have a light “light up” and maybe a sound… can anyone help?! or is there code out there for something similar that I could edit a bit to get what I’m looking for… Thanks in advance!
here is a project that was done for the world cup… https://community.electricimp.com/blog/world-cup-goal-light/ I think I could take this code and change it to point to the .mlb.com scoreboard and them somehow drill it down to a specific team…
It’s all about finding a website (preferably using an API) that posts instant and accurate scores. A website that you can query (using the imp agent) every 10 seconds or so. Maybe easy to find a website that posts scores, but to query it frequently is not so easy. Most likely something like an API service that you would need to pay for. Once you find such a service, the rest is easy (the imp, agent, and hardware portion).
To parse a website’s HTML (called “scraping”) without the site owner’s permission is unethical. It burdens a site’s bandwidth, and in most cases, it infringes on copyright laws. If you had your own website, you would not be very happy if people were stealing your content and using it for their own purposes. I would never recommend scraping someone’s site without permission.
That is the purpose of an API. An API is the site owner’s method of allowing people to access their data, database, content, etc. The site owner provides specific instructions, rules, terms of service, and in some cases, a user-key that costs money to use.
Do you even have access to the code running gear on the light?
The developer edition of the imp got access to agent and device code, but imps used in products is usually not developer editions. Those are assigned to the manufacturer of the product instead.