esp8266 css,GitHub - jasoncoon/esp8266-fastled-audio

FastLED + ESP8266 Web Server

Control an addressable LED strip with an ESP8266 via a web browser or infrared remote control.

Hardware

MSGEQ7 breakout board (7-band graphic equalizer for audio):

0208f33f1ff4b9cdb914ad43fca43916.png

An ESP8266 development board, such as the Adafruit HUZZAH ESP8266 Breakout:

97cbd7cfc4baa870b1e8e8a3c50e575a.png

Addressable LED strip, such as the Adafruit NeoPixel Ring:

77d978cb09f3b9651f815ccd32526184.png

Features

Turn the NeoPixel Ring on and off

Adjust the brightness

Change the display pattern

Adjust the color

Web App

webapp.png

Patterns are requested by the app from the ESP8266, so as new patterns are added, they're automatically listed in the app.

The web app is stored in SPIFFS (on-board flash memory).

The web app is a single page app with separate files for js and css, using jQuery and Bootstrap. It has buttons for On/Off, a slider for brightness, a pattern selector, and a color picker (using jQuery MiniColors). Event handlers for the controls are wired up, so you don't have to click a 'Send' button after making changes. The brightness slider and the color picker use a delayed event handler, to prevent from flooding the ESP8266 web server with too many requests too quickly.

The only drawback to SPIFFS that I've found so far is uploading the files is extremely slow, requiring several minutes, regardless of how large the files are. It's so slow that I've been just developing the web app and debugging locally on my desktop (with a hard-coded IP for the ESP8266), before uploading to SPIFFS and testing on the ESP8266.

Installing

The web app needs to be uploaded to the ESP8266's SPIFFS. You can do this within the Arduino IDE after installing the Arduino ESP8266FS tool.

With ESP8266FS installed run the sketch and then upload the web app using ESP8266 Sketch Data Upload command in the Arduino Tools menu.

Compression

The web app files can be gzip compressed before uploading to SPIFFS by running the following command:

gzip -r data/

The ESP8266WebServer will automatically serve any .gz file. The file index.htm.gz will get served as index.htm, with the content-encoding header set to gzip, so the browser knows to decompress it. The ESP8266WebServer doesn't seem to like the Glyphicon fonts gzipped, though, so I decompress them with this command:

gunzip -r data/fonts/

REST Web services

The firmware implements basic RESTful web services using the ESP8266WebServer library. Current values are requested with HTTP GETs, and values are set with POSTs using query string parameters. It can run in connected or standalone access point modes.

Audio

Hook the MSGEQ7 breakout board up:

#define MSGEQ7_AUDIO_PIN A0

#define MSGEQ7_STROBE_PIN D0

#define MSGEQ7_RESET_PIN D3

Infrared Remote Control

Control via infrared remote control is also supported, via the ESP8266 port of the IRremote library.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值