Added a status indicator LED that blinks when command is received
This commit is contained in:
parent
2a87d040a7
commit
e677742584
@ -5,7 +5,7 @@
|
|||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
#include <ws2812_i2s.h>
|
#include <ws2812_i2s.h>
|
||||||
|
|
||||||
#define NUM_LEDS 240
|
#define NUM_LEDS 260
|
||||||
#define BUFFER_LEN 1024
|
#define BUFFER_LEN 1024
|
||||||
|
|
||||||
// Wifi and socket settings
|
// Wifi and socket settings
|
||||||
@ -21,8 +21,10 @@ static Pixel_t pixels[NUM_LEDS];
|
|||||||
WiFiUDP port;
|
WiFiUDP port;
|
||||||
|
|
||||||
// Network information
|
// Network information
|
||||||
IPAddress ip(192, 168, 1, 150);
|
IPAddress ip(192, 168, 137, 150);
|
||||||
IPAddress gateway(192, 168, 1, 1);
|
IPAddress gateway(192, 168, 137, 1);
|
||||||
|
//IPAddress ip(192, 168, 0, 150);
|
||||||
|
//IPAddress gateway(192, 168, 0, 1);
|
||||||
IPAddress subnet(255, 255, 255, 0);
|
IPAddress subnet(255, 255, 255, 0);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
@ -42,6 +44,7 @@ void setup() {
|
|||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
port.begin(localPort);
|
port.begin(localPort);
|
||||||
ledstrip.init(NUM_LEDS);
|
ledstrip.init(NUM_LEDS);
|
||||||
|
pinMode(0, OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t N = 0;
|
uint8_t N = 0;
|
||||||
@ -52,17 +55,16 @@ void loop() {
|
|||||||
|
|
||||||
// If packets have been received, interpret the command
|
// If packets have been received, interpret the command
|
||||||
if (packetSize) {
|
if (packetSize) {
|
||||||
int len = port.read(packetBuffer, BUFFER_LEN);
|
digitalWrite(0, 1);
|
||||||
|
int len = port.read(packetBuffer, BUFFER_LEN);
|
||||||
for(int i = 0; i < len; i+=4){
|
for(int i = 0; i < len; i+=4){
|
||||||
packetBuffer[len] = 0;
|
packetBuffer[len] = 0;
|
||||||
N = packetBuffer[i];
|
N = packetBuffer[i];
|
||||||
pixels[N].R = (uint8_t)packetBuffer[i+1];
|
pixels[N].R = (uint8_t)packetBuffer[i+1];
|
||||||
pixels[N].G = (uint8_t)packetBuffer[i+2];
|
pixels[N].G = (uint8_t)packetBuffer[i+2];
|
||||||
pixels[N].B = (uint8_t)packetBuffer[i+3];
|
pixels[N].B = (uint8_t)packetBuffer[i+3];
|
||||||
}
|
}
|
||||||
//ledstrip.show(pixels);
|
ledstrip.show(pixels);
|
||||||
}
|
digitalWrite(0, 0);
|
||||||
|
}
|
||||||
// Always update strip to improve temporal dithering performance
|
|
||||||
ledstrip.show(pixels);
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from __future__ import division
|
||||||
import socket
|
import socket
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import config
|
import config
|
||||||
@ -26,7 +27,5 @@ def update():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
pixels = pixels * 0
|
pixels *= 0
|
||||||
pixels = pixels
|
update()
|
||||||
update()
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user