This project enables an ESP32 to fetch cryptocurrency information from the Bitstamp API and display the 24-hour percentage change value on a WS2812B LED strip.
- The ESP32 connects to WiFi and retrieves data from the Bitstamp API.
- It reads the 24-hour percentage change (
percent_change_24
) for BTC/USD. - Based on the
percent_change_24
value, the LEDs light up in different colors:- Green: for a change of more than 5%
- Red: for a change of less than -5%
- White: for a change between -5% and 5%
- An ESP32 microcontroller
- WS2812B LED strip
- Power supply for both the LED strip and ESP32
- Arduino IDE
- FastLED library
- ArduinoJson library
- WiFi library
- Install the FastLED and ArduinoJson libraries via the Arduino IDE.
- Upload the code to your ESP32.
- Change the
ssid
andpassword
variables to your WiFi credentials. - If necessary, adjust the number of LEDs (
NUM_LEDS
) and the connected pin (LED_PIN
).
#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <FastLED.h>
// ... (Code shortened for documentation)
void updateLEDColor(float percentChange) {
// Change LED colors based on the percentage value
}
void setAllLEDs(CRGB color) {
// Sets the color of all LEDs in the strip
}
- [Pilotkosinus] - Project initiator and main developer