From 891bf470fe644bd9610cbe77628fb4f5bb7b2146 Mon Sep 17 00:00:00 2001 From: Joey Babcock Date: Thu, 29 Dec 2016 16:40:51 -0800 Subject: [PATCH] added macro for fps enabling --- arduino/ws2812_controller/ws2812_controller.ino | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arduino/ws2812_controller/ws2812_controller.ino b/arduino/ws2812_controller/ws2812_controller.ino index 454faa4..c49bd66 100644 --- a/arduino/ws2812_controller/ws2812_controller.ino +++ b/arduino/ws2812_controller/ws2812_controller.ino @@ -8,6 +8,7 @@ // Set this to the number of LEDs in your LED strip #define NUM_LEDS 260 #define BUFFER_LEN 1024 +#define PRINT_FPS 1 // Wifi and socket settings const char* ssid = "YOUR_WIFI_SSID"; @@ -44,13 +45,13 @@ void setup() { Serial.println(WiFi.localIP()); port.begin(localPort); ledstrip.init(NUM_LEDS); - pinMode(0, OUTPUT); } uint8_t N = 0; +#ifdef PRINT_FPS int fpsCounter = 0; int secondTimer = 0; -int redLedTimer = 0; +#endif void loop() { // Read data over socket int packetSize = port.parsePacket(); @@ -67,10 +68,11 @@ void loop() { } ledstrip.show(pixels); Serial.print("*"); - fpsCounter++; - digitalWrite(0, 0); + #ifdef PRINT_FPS + fpsCounter++; + #endif } - + #ifdef PRINT_FPS if(millis() - secondTimer >= 1000) { secondTimer = millis(); @@ -78,4 +80,5 @@ void loop() { Serial.printf("FPS: %d\n", fpsCounter); fpsCounter = 0; } + #endif }