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:
- 3:e5ea80fae61d
- Parent:
- 2:99eb4c6e9ea4
- Child:
- 4:b521815f2657
--- a/ledstrip.cpp Sat Aug 29 05:33:30 2015 +0000
+++ b/ledstrip.cpp Mon Aug 31 09:03:15 2015 +0000
@@ -146,6 +146,28 @@
unsigned char* pBuf = GetBuffer() + pos;
memcpy(pBuf, pLedVals, numLeds * mColoursPerLed);
}
+
+void ledstrip::HsvFill(int startLed, int numLeds, const unsigned char* pLedVals)
+{
+ if ((startLed < 0) || (startLed >= mLedsInStrip))
+ return;
+ if (numLeds >= mLedsInStrip - startLed)
+ numLeds = mLedsInStrip - startLed;
+ int pos = startLed * mColoursPerLed;
+ unsigned char* pBuf = GetBuffer() + pos;
+
+ // 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));
+ pBuf[pos] = colrVal.r;
+ pBuf[pos+1] = colrVal.g;
+ pBuf[pos+2] = colrVal.b;
+// printf("HSV %d %d %d RGB %d %d %d\r\n", pLedVals[0],pLedVals[1] & 0xf0, (pLedVals[1] << 4) & 0xf0, colrVal.r, colrVal.g, colrVal.b);
+ pos += mColoursPerLed;
+ pLedVals += 2;
+ }
+}
// Fill - solid colour
void ledstrip::Fill(int startLed, int numLeds,
@@ -236,7 +258,7 @@
// Check if busy
while (isr0Busy || isr1Busy)
wait_us(2000);
- wait_us(2000);
+// wait_us(2000);
// Set up start points
mCurPos0 = 0;