-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPIXELSCAN.ino
56 lines (51 loc) · 1.51 KB
/
PIXELSCAN.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
void pixelscope() {
uint8_t i, r, g , b;
int address ;
char buff[10];
uint32_t pcol ;
uint32_t xcol ;
uint8_t j ;
SendHTTPHeader();
server.sendContent(F("<center><b>Pixel Scope</b><br><table border=1 title='Pixel Scope'><tr><th>.</th>"));
// table header
switch(strip[0].numPixels()){
case 64:
j = 8 ;
break;
case 600:
j = 20 ;
break;
default:
j = 16 ;
break;
}
for (i = 0; i < j; i++) {
if (strip[0].numPixels() == 600 ) {
server.sendContent("<th>"+String(i)+"</th>");
}else{
server.sendContent("<th>"+String(i,HEX)+"</th>");
}
}
server.sendContent(F("</tr>"));
for (address = 0; address < strip[0].numPixels(); address++) {
if (address % j == 0) {
server.sendContent(F("<tr>"));
if (strip[0].numPixels() == 600 ) {
server.sendContent("<td align=center><b>"+String((address ))+"</b></td>");
}else{
server.sendContent("<td align=center><b>"+String((address ),HEX)+"</b></td>");
}
}
pcol = strip[0].getPixelColor(address) ;
xcol = pcol ^ 0xffffff ;
r = ( pcol >> 16 ) & 0xff ;
g = ( pcol >> 8 ) & 0xff ;
b = ( pcol ) & 0xff ;
snprintf(buff, BUFF_MAX, "%02X%02X%02X", r, g ,b );
server.sendContent("<td bgcolor='"+String(buff)+"'><font color='"+String(xcol,HEX)+"'>"+String(buff)+"</font></td>");
if (address % j == (j-1)) {
server.sendContent(F("</tr>"));
}
}
server.sendContent(F("</tr></table></body></html>\r\n"));
}