Spidey Wall is the name for a physical wall lit up by multiple addressable LED strips. This program is an LPC1768 web server to control the wall from a browser.
Dependencies: EthernetInterfacePlusHostname RdWebServer mbed-rtos mbed
This project is part of a Light-Wall using addressable LED strips (WS2801). I have published a few posts on my blog about the construction of the wall and building a game to play on it (PacMan). I have also had a guest post from a friend who has set his children the task of producing some interesting animations. The original post is http://robdobson.com/2015/07/spidey-wall/
So far, however, I hadn't fully connected the physical (and electronic) wall with the web-browser creations to drive it. This project is hopefully the final link. A fast and reliable web server using REST commands to drive the 1686 LEDs in the Spidey Wall from code running in a browser (say on an iPad while you are playing a game).
The approach taken here results in the ability to control the RGB values of all 1686 LEDs at a rate of 20 frames per second.
A blog post describing the whole thing is here:
http://robdobson.com/2015/08/a-reliable-mbed-webserver/
Diff: ledstrip.cpp
- Revision:
- 6:8df79fe1afcd
- Parent:
- 4:b521815f2657
diff -r 910909f34907 -r 8df79fe1afcd ledstrip.cpp
--- a/ledstrip.cpp Tue Sep 01 15:53:52 2015 +0000
+++ b/ledstrip.cpp Thu Sep 03 20:17:23 2015 +0000
@@ -160,7 +160,8 @@
// Copy over the values converting each to RGB
for (int i = 0; i < numLeds; i++)
{
- RgbColor colrVal = HsvToRgb(HsvColor(pLedVals[0],pLedVals[1] & 0xf0, (pLedVals[1] << 4) & 0xf0));
+ RgbColor colrVal(0,0,0);
+ HsvToRgb(HsvColor(pLedVals[0],pLedVals[1] & 0xf0, (pLedVals[1] << 4) & 0xf0), colrVal);
pBuf[pos] = colrVal.r;
pBuf[pos+1] = colrVal.g;
pBuf[pos+2] = colrVal.b;
@@ -209,9 +210,11 @@
numLeds = mLedsInStrip - startLed;
int pos = startLed * mColoursPerLed;
RgbColor startRGB(r1,g1,b1);
- HsvColor startHsv = RgbToHsv(startRGB);
+ HsvColor startHsv(0,0,0);
+ RgbToHsv(startRGB, startHsv);
RgbColor endRGB(r2,g2,b2);
- HsvColor endHsv = RgbToHsv(endRGB);
+ HsvColor endHsv(0,0,0);
+ RgbToHsv(endRGB, endHsv);
int curH = startHsv.h << 16;
int curS = startHsv.s << 16;
int curV = startHsv.v << 16;
@@ -238,7 +241,8 @@
unsigned char* pBuf = GetBuffer();
for (int i = 0; i < numLeds; i++)
{
- RgbColor colrVal = HsvToRgb(HsvColor((curH>>16)&0xff,curS>>16,curV>>16));
+ RgbColor colrVal(0,0,0);
+ HsvToRgb(HsvColor((curH>>16)&0xff,curS>>16,curV>>16), colrVal);
pBuf[pos] = colrVal.r;
pBuf[pos+1] = colrVal.g;
pBuf[pos+2] = colrVal.b;