GithubHelp home page GithubHelp logo

rivm-stookalert's Introduction

RIVM-Stookalert

RIVM Stookalert is completely generated by https://chat.openai.com/chat

URL RIVM api: https://www.rivm.nl/media/lml/stookalert/stookalert_20230218.json

This script is an Arduino sketch designed for an ESP8266 microcontroller board with a NeoPixel LED attached. It connects to a WiFi network and retrieves data from an API provided by the Dutch National Institute for Public Health and the Environment (RIVM) about the air quality in the Dutch province of Drenthe. If the air quality is good, the LED will light up green, and if it is bad, the LED will light up red.

The script begins by including the required libraries, which include the ESP8266 WiFi library, the ESP8266 HTTP client library, the WiFiUdp library, and the Adafruit NeoPixel library. It then defines some constants, including the WiFi network name and password, the NTP server to use for time synchronization, the GMT and daylight offsets, the RIVM API host and port number, and the pin number for the LED.

In the setup() function, the script initializes the serial connection, connects to the WiFi network, and synchronizes the time with the NTP server. It then initializes the NeoPixel strip.

In the loop() function, the script retrieves the current time and formats it as a string, which is printed to the serial console for debugging purposes. It then constructs the URL for the RIVM API call, based on the current date. The script uses the WiFiClientSecure class to create a secure connection to the RIVM API server, using the HTTPS protocol. It then makes an HTTP GET request to the server, which retrieves the air quality data for Drenthe. If the API returns a status code of 200 (indicating success), the script extracts the Drenthe air quality value from the response payload, which is a JSON-formatted string. If the air quality is good (with a value of 0), the LED will light up green, and if it is bad (with a value of 1 or greater), the LED will light up red. Finally, the script waits for one minute before repeating the loop.

rivm-stookalert's People

Contributors

ltvanderkrogt avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.