LED Controler

master
VogelT 2 years ago
commit a5211a1d49

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="io.sloeber.core.sketch.0">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="io.sloeber.core.sketch.0" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" cleanCommand="rm -f" description="" id="io.sloeber.core.sketch.0" name="Release" parent="io.sloeber.core.configuration.release">
<folderInfo id="io.sloeber.core.sketch.0." name="/" resourcePath="">
<toolChain id="io.sloeber.core.toolChain.release.901689175" name="Arduino Toolchain (Sloeber edition)" superClass="io.sloeber.core.toolChain.release">
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="io.sloeber.targetplatform.1565289859" name="Arduino Target" osList="all" superClass="io.sloeber.targetplatform"/>
<builder buildPath="${workspace_loc:/ledcontroler}/Release" id="io.sloeber.sketch.builder.804568195" keepEnvironmentInBuildfile="false" name="Arduino sketch builder" parallelBuildOn="false" superClass="io.sloeber.sketch.builder"/>
<tool id="io.sloeber.tool.sketch.compiler.cpp.1180983118" name="Arduino C++ Compiler" superClass="io.sloeber.tool.sketch.compiler.cpp">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="io.sloeber.compiler.cpp.sketch.option.incpath.843884344" name="Include Paths (-I)" superClass="io.sloeber.compiler.cpp.sketch.option.incpath" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/core/variant}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/core/core}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/FastLED-master/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/Hash/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/Wire}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/ESPAsyncWebServer-master/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/SPI}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/ESPAsyncTCP-master/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/ArduinoAsync-master}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/ESP8266WiFi/src}&quot;"/>
</option>
<inputType id="io.sloeber.compiler.cpp.sketch.input.2020829710" name="CPP source files" superClass="io.sloeber.compiler.cpp.sketch.input"/>
</tool>
<tool id="io.sloeber.tool.compiler.c.991379426" name="Arduino C Compiler" superClass="io.sloeber.tool.compiler.c">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="io.sloeber.compiler.c.sketch.option.incpath.71332427" name="Include Paths (-I)" superClass="io.sloeber.compiler.c.sketch.option.incpath" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/core/variant}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/core/core}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/FastLED-master/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/Hash/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/Wire}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/ESPAsyncWebServer-master/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/SPI}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/ESPAsyncTCP-master/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/ArduinoAsync-master}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/ESP8266WiFi/src}&quot;"/>
</option>
<inputType id="io.sloeber.compiler.c.sketch.input.918861019" name="C Source Files" superClass="io.sloeber.compiler.c.sketch.input"/>
</tool>
<tool id="io.sloeber.tool.sketch.compiler.s.1857758123" name="Arduino Assembler" superClass="io.sloeber.tool.sketch.compiler.s">
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="io.sloeber.compiler.asm.sketch.option.incpath.955021265" name="Include Paths (-I)" superClass="io.sloeber.compiler.asm.sketch.option.incpath" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/core/variant}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/core/core}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/FastLED-master/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/Hash/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/Wire}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/ESPAsyncWebServer-master/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/SPI}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/ESPAsyncTCP-master/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/ArduinoAsync-master}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/ledcontroler/libraries/ESP8266WiFi/src}&quot;"/>
</option>
<inputType id="io.sloeber.compiler.S.sketch.input.1171029193" name="Assembly source files" superClass="io.sloeber.compiler.S.sketch.input"/>
</tool>
<tool id="io.sloeber.tool.ar.1052477532" name="Arduino archiver" superClass="io.sloeber.tool.ar"/>
<tool id="io.sloeber.tool.combine.95621510" name="Arduino combiner" superClass="io.sloeber.tool.combine"/>
<tool id="io.sloeber.tool.objcopy.eep.254837048" name="Arduino tool objcopy command" superClass="io.sloeber.tool.objcopy.eep"/>
<tool id="io.sloeber.tool.size.167108244" name="Arduino tool Print Size" superClass="io.sloeber.tool.size"/>
</toolChain>
</folderInfo>
<folderInfo id="io.sloeber.core.sketch.0.libraries/**/._*" resourcePath="libraries/**/._*">
<toolChain id="io.sloeber.core.toolChain5.1752106428" superClass="io.sloeber.core.toolChain5">
<targetPlatform id="io.sloeber.core.sketch.0.libraries/**/._*.937556729" name=""/>
</toolChain>
</folderInfo>
<folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/test*/**" resourcePath="libraries/?*/**/test*/**">
<toolChain id="io.sloeber.core.toolChain3.315046882" superClass="io.sloeber.core.toolChain3">
<targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/test*/**.1583132078" name=""/>
</toolChain>
</folderInfo>
<folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/?xtras/**" resourcePath="libraries/?*/**/?xtras/**">
<toolChain id="io.sloeber.core.toolChain2.2062238609" superClass="io.sloeber.core.toolChain2">
<targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/?xtras/**.1281740295" name=""/>
</toolChain>
</folderInfo>
<folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/?xamples/**" resourcePath="libraries/?*/**/?xamples/**">
<toolChain id="io.sloeber.core.toolChain1.1660321220" superClass="io.sloeber.core.toolChain1">
<targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/?xamples/**.1122984955" name=""/>
</toolChain>
</folderInfo>
<folderInfo id="io.sloeber.core.sketch.0.libraries/?*/**/third-party/**" resourcePath="libraries/?*/**/third-party/**">
<toolChain id="io.sloeber.core.toolChain4.2008337826" superClass="io.sloeber.core.toolChain4">
<targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/**/third-party/**.1112463808" name=""/>
</toolChain>
</folderInfo>
<folderInfo id="io.sloeber.core.sketch.0.libraries/?*/utility/*/*" resourcePath="libraries/?*/utility/*/*">
<toolChain id="io.sloeber.core.toolChain6.1805885686" superClass="io.sloeber.core.toolChain6">
<targetPlatform id="io.sloeber.core.sketch.0.libraries/?*/utility/*/*.16937813" name=""/>
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="libraries/FastLED-master/docs|libraries/FastLED-master/ci|libraries/FastLED-master/.github|libraries/ESPAsyncWebServer-master/travis|libraries/ESPAsyncTCP-master/ssl|libraries/ESPAsyncTCP-master/.github|libraries/?*/**/?xamples/**|libraries/?*/**/?xtras/**|libraries/?*/**/test*/**|libraries/?*/**/third-party/**|libraries/**/._*|libraries/?*/utility/*/*" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="ledcontroler.io.sloeber.core.sketch.1716917812" name="Arduino sketch" projectType="io.sloeber.core.sketch"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
<storageModule moduleId="refreshScope"/>
</cproject>

@ -0,0 +1,2 @@
/Release/
/sloeber.ino.cpp

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ledcontroler</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>io.sloeber.core.inoToCpp</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>io.sloeber.arduinonature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>ArduinoAsync-master</name>
<type>2</type>
<locationURI>WORKSPACE_LOC/ArduinoAsync-master</locationURI>
</link>
<link>
<name>core/core</name>
<type>2</type>
<locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266</locationURI>
</link>
<link>
<name>core/variant</name>
<type>2</type>
<locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/3.0.2/variants/d1_mini</locationURI>
</link>
<link>
<name>libraries/ESP8266WiFi</name>
<type>2</type>
<locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/3.0.2/libraries/ESP8266WiFi</locationURI>
</link>
<link>
<name>libraries/ESPAsyncTCP-master</name>
<type>2</type>
<location>C:/Users/vogelt/Documents/Arduino/libraries/ESPAsyncTCP-master</location>
</link>
<link>
<name>libraries/ESPAsyncWebServer-master</name>
<type>2</type>
<location>C:/Users/vogelt/Documents/Arduino/libraries/ESPAsyncWebServer-master</location>
</link>
<link>
<name>libraries/FastLED-master</name>
<type>2</type>
<location>C:/Users/vogelt/Documents/Arduino/libraries/FastLED-master</location>
</link>
<link>
<name>libraries/Hash</name>
<type>2</type>
<locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/3.0.2/libraries/Hash</locationURI>
</link>
<link>
<name>libraries/SPI</name>
<type>2</type>
<locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/3.0.2/libraries/SPI</locationURI>
</link>
<link>
<name>libraries/Wire</name>
<type>2</type>
<locationURI>ECLIPSE_HOME/arduinoPlugin/packages/esp8266/hardware/esp8266/3.0.2/libraries/Wire</locationURI>
</link>
</linkedResources>
</projectDescription>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<configuration id="io.sloeber.core.sketch.0" name="Release">
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
<provider class="io.sloeber.core.toolchain.ArduinoLanguageProvider" console="false" env-hash="-191870581023958806" id="io.sloeber.languageSettingsProvider" keep-relative-paths="false" name="Arduino Compiler Settings" parameter="${COMMAND} -E -P -v -dD -D__IN_ECLIPSE__ &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
</extension>
</configuration>
</project>

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=windows-1252

@ -0,0 +1,29 @@
Config.Release.board.BOARD.ID=d1_mini
Config.Release.board.BOARD.MENU.baud=115200
Config.Release.board.BOARD.MENU.dbg=Disabled
Config.Release.board.BOARD.MENU.eesz=4M2M
Config.Release.board.BOARD.MENU.exception=disabled
Config.Release.board.BOARD.MENU.ip=lm2f
Config.Release.board.BOARD.MENU.lvl=None____
Config.Release.board.BOARD.MENU.mmu=3232
Config.Release.board.BOARD.MENU.non32xfer=fast
Config.Release.board.BOARD.MENU.ssl=all
Config.Release.board.BOARD.MENU.stacksmash=disabled
Config.Release.board.BOARD.MENU.vt=flash
Config.Release.board.BOARD.MENU.wipe=none
Config.Release.board.BOARD.MENU.xtal=160
Config.Release.board.BOARD.TXT=${SLOEBER_HOME}/arduinoPlugin/packages/esp8266/hardware/esp8266/3.0.2/boards.txt
Config.Release.board.PROGRAMMER.NAME=
Config.Release.board.UPLOAD.PORT=COM11
Config.Release.compile.sloeber.extra.all=
Config.Release.compile.sloeber.extra.archive=
Config.Release.compile.sloeber.extra.assembly=
Config.Release.compile.sloeber.extra.c.compile=
Config.Release.compile.sloeber.extra.compile=
Config.Release.compile.sloeber.extra.cpp.compile=
Config.Release.compile.sloeber.extra.link=
Config.Release.compile.sloeber.size.custom=
Config.Release.compile.sloeber.size.type=RAW_RESULT
Config.Release.compile.sloeber.warning_level=NONE
Config.Release.compile.sloeber.warning_level.custom=
Config.Release.other.IS_VERSION_CONTROLLED=false

@ -0,0 +1,323 @@
#include <Wire.h>
#include "Arduino.h"
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <FastLED.h>
#include <async.h>
const boolean DEBUG = true;
const boolean LED_RUN = true;
boolean BUTTONSERVER_ACTIV = false;
boolean UPDATE_LEDS = false;
// Replace with your network credentials
const char *ssid = "FRITZ!BoxWZ";
const char *password = "40360548708873074408";
IPAddress ip(192, 168, 178, 12);
IPAddress subnet(255, 255, 255, 0);
IPAddress gateway(192, 168, 178, 1);
const char *PARAM_INPUT_1 = "speed";
const char *PARAM_INPUT_2 = "modus";
// Create AsyncWebServer object on port 88
AsyncWebServer server(88);
Async asyncEngine = Async();
Async asyncEngineReset = Async();
/*
* define your ws2812fx presets
*/
#define LED_PIN_1 D7
#define LED_PIN_2 D8
// Fastled:
#define NUM_LEDS_1 38
#define NUM_LEDS_2 144 // Total of 216 LED's 24 x 9 Panels | 24, 48, 72, 96, 120, 144, 168, 192, 216
#define MILLI_AMPS 2400
#define LED_TYPE WS2812B
#define COLOR_ORDER_1 GRB
#define COLOR_ORDER_2 GRB
#define UPDATES_PER_SECOND 100
#define BRIGHTNESS 64
CRGB LEDsStatus[NUM_LEDS_1];
//CRGB LEDsPanel[NUM_LEDS_2];
#define COOLING 55
#define FRAMES_PER_SECOND 200
bool gReverseDirection = false;
bool variDemo = false;
int ledOn = 0;
void ledDemoApp(boolean start) {
variDemo = true;
}
void initWebService() {
// Send a GET request to <ESP_IP>/update?output=<inputMessage1>&state=<inputMessage2>
server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request) {
String inputMessage1;
String inputMessage2;
// GET input1 value on <ESP_IP>/update?output=<inputMessage1>&state=<inputMessage2>
if (request->hasParam(PARAM_INPUT_1) && request->hasParam(PARAM_INPUT_2)) {
inputMessage1 = request->getParam(PARAM_INPUT_1)->value();
inputMessage2 = request->getParam(PARAM_INPUT_2)->value();
//digitalWrite(inputMessage1.toInt(), inputMessage2.toInt());
}
else {
inputMessage1 = "No message sent";
inputMessage2 = "No message sent";
}
/*
Serial.print("GPIO: ");
Serial.print(inputMessage1);
Serial.print(" - Set to: ");
Serial.println(inputMessage2);
*/
request->send(200, "text/plain", "OK");
});
// ledfxon
server.on("/ledfxon", HTTP_GET, [] (AsyncWebServerRequest *request) {
String inputMessage1;
String inputMessage2;
// GET input1 value on <ESP_IP>/ledfxon?speed=<inputMessage1>&modus=<inputMessage2>
if (request->hasParam(PARAM_INPUT_1) && request->hasParam(PARAM_INPUT_2)) {
inputMessage1 = request->getParam(PARAM_INPUT_1)->value();
inputMessage2 = request->getParam(PARAM_INPUT_2)->value();
}
else {
inputMessage1 = 100;
inputMessage2 = "SCAN";
}
int speedled = 100;
String modus = "FX_MODE_SCAN";
speedled = inputMessage1.toInt();
inputMessage2.toUpperCase();
modus = inputMessage2;
//startFastLed(speedled, modus);
request->send(200, "text/plain", "OK");
});
server.on("/ledtest", HTTP_GET, [] (AsyncWebServerRequest *request) {
request->send(200, "text/plain", "OK");
});
server.on("/ledDemoOn", HTTP_GET, [] (AsyncWebServerRequest *request) {
ledDemoApp(true);
ledOn = 1;
request->send(200, "text/plain", "LED on");
});
server.on("/ledDemoOff", HTTP_GET, [] (AsyncWebServerRequest *request) {
ledDemoApp(false);
ledOn = 0;
stopLed();
request->send(200, "text/plain", "LED off");
});
server.on("/ledmodus", HTTP_GET, [] (AsyncWebServerRequest *request) {
String inputMessage1;
// GET input1 value on <ESP_IP>/ledfxon?speed=<inputMessage1>&modus=<inputMessage2>
if (request->hasParam(PARAM_INPUT_2)) {
inputMessage1 = request->getParam(PARAM_INPUT_2)->value();
}
else {
inputMessage1 = "0";
}
int modus = 0;
modus = inputMessage1.toInt();
//changeModus(modus);
String text = "Start Modus " + inputMessage1 + " OK";
request->send(200, "text/plain", text);
});
server.on("/ledoff", HTTP_GET, [] (AsyncWebServerRequest *request) {
//stopFastLed();
request->send(200, "text/plain", "LED OFF");
});
// Start server
server.begin();
}
//The setup function is called once at startup of the sketch
void setup() {
Serial.begin(9600);
Serial.println("");
Wire.begin();
pinMode(D4, OUTPUT);
randomSeed(analogRead(0));
if (connectWifi()) {
// Init Panels
FastLed();
//initAllPanels();
initWebService();
} else {
digitalWrite(D4, LOW);
}
}
// ------------ FINISH -----------------
boolean connectWifi() {
boolean stat = true;
// Connect to Wi-Fi
WiFi.config(ip, gateway, subnet); // uncomment for dynamic IP
WiFi.begin(ssid, password);
int count = 0;
while (WiFi.status() != WL_CONNECTED) {
count++;
digitalWrite(D4, LOW);
delay(1000);
digitalWrite(D4, HIGH);
Serial.println("Connecting to WiFi..");
if (count == 10) {
stat = false;
break;
}
}
if (stat == true) {
digitalWrite(D4, LOW);
// Print ESP Local IP Address
Serial.println(WiFi.localIP());
}
return stat;
}
void FastLed() {
FastLED.addLeds<LED_TYPE, LED_PIN_1, COLOR_ORDER_1>(LEDsStatus, NUM_LEDS_1);
//FastLED.addLeds<LED_TYPE, LED_PIN_2, COLOR_ORDER_2>(LEDsPanel, NUM_LEDS_2);
FastLED.setBrightness(BRIGHTNESS);
}
// The loop function is called in an endless loop
void loop() {
if (variDemo == true && ledOn == 1) {
ledDemo();
}
//Fire2012(); // run simulation frame
//FastLED.show(); // display this frame
//FastLED.delay(1000 / FRAMES_PER_SECOND);
}
void stopLed() {
for (int panel = 0; panel < NUM_LEDS_1; panel++) {
LEDsStatus[panel] = CRGB::Black;
}
FastLED.show();
FastLED.clearData();
FastLED.show();
FastLED.clear();
FastLED.show();
}
void ledDemo() {
LEDsStatus[0] = CRGB::Red;
FastLED.show();
delay(500);
for (int panel = 0; panel < NUM_LEDS_1; panel++) {
LEDsStatus[panel] = CRGB::Yellow;
}
FastLED.show();
delay(500);
for (int panel = 0; panel < NUM_LEDS_1; panel++) {
LEDsStatus[panel] = CRGB::Green;
}
for (int panel = 0; panel < NUM_LEDS_1; panel++) {
LEDsStatus[panel] = CRGB::Green;
}
FastLED.show();
delay(500);
// Now turn the LED off, then pause
for (int panel = 0; panel < NUM_LEDS_1; panel++) {
LEDsStatus[panel] = CRGB::Black;
}
FastLED.show();
delay(500);
}
// SPARKING: What chance (out of 255) is there that a new spark will be lit?
// Higher chance = more roaring fire. Lower chance = more flickery fire.
// Default 120, suggested range 50-200.
#define SPARKING 120
void Fire2012()
{
// Array of temperature readings at each simulation cell
static uint8_t heat[LED_PIN_1];
// Step 1. Cool down every cell a little
for( int i = 0; i < LED_PIN_1; i++) {
heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / LED_PIN_1) + 2));
}
// Step 2. Heat from each cell drifts 'up' and diffuses a little
for( int k= LED_PIN_1 - 1; k >= 2; k--) {
heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
}
// Step 3. Randomly ignite new 'sparks' of heat near the bottom
if( random8() < SPARKING ) {
int y = random8(7);
heat[y] = qadd8( heat[y], random8(160,255) );
}
// Step 4. Map from heat cells to LED colors
for( int j = 0; j < LED_PIN_1; j++) {
CRGB color = HeatColor( heat[j]);
int pixelnumber;
if( gReverseDirection ) {
pixelnumber = (LED_PIN_1-1) - j;
} else {
pixelnumber = j;
}
Serial.print("Panel: ");
Serial.println(pixelnumber);
LEDsStatus[pixelnumber] = color;
}
}

@ -0,0 +1,2 @@
spec.o: \
C:/workspace/Arduino/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.cpp
Loading…
Cancel
Save