Added second LED library

This commit is contained in:
Ollo 2024-11-29 23:13:53 +01:00
parent e56a3a381d
commit c48d977f42
2 changed files with 17 additions and 12 deletions

View File

@ -19,4 +19,7 @@
#define GPIO_WS2812_PIN1 D3
#define WS2812_LEDS1 1
#define GPIO_WS2812_PIN2 D4
#define WS2812_LEDS2 10
#endif /* End FANLEDCTL_PINS */

View File

@ -20,7 +20,9 @@
/******************************************************************************
* LOCAL VARIABLES
******************************************************************************/
Adafruit_NeoPixel* pPixels = NULL;
Adafruit_NeoPixel* pPixelFan = NULL;
Adafruit_NeoPixel* pPixel = NULL;
OneWire oneWire(GPIO_DS18B20);
DallasTemperature sensors(&oneWire);
@ -36,16 +38,15 @@ void setup() {
pinMode(SIGNAL_PIN, INPUT);
pPixels = new Adafruit_NeoPixel(WS2812_LEDS1, GPIO_WS2812_PIN1, NEO_RGB + NEO_KHZ800);
pPixelFan = new Adafruit_NeoPixel(WS2812_LEDS1, GPIO_WS2812_PIN1, NEO_RGB + NEO_KHZ800);
pPixels->begin();
pPixels->clear();
pPixels->fill(pPixels->Color(255,0,0));
pPixels->setBrightness(100);
pPixels->show();
pPixelFan->begin();
pPixelFan->clear();
pPixelFan->fill(pPixelFan->Color(255,0,0));
pPixelFan->setBrightness(100);
pPixelFan->show();
/* Initialize Temperature sensor */
/* Initialize Temperature sensor */
sensors.begin();
for(int j=0; j < TEMP_SENSOR_MEASURE_SERIES && sensors.getDeviceCount() == 0; j++)
{
@ -116,9 +117,9 @@ void loop() {
fanSpeedPercent = (100 - MIN_FAN_SPEED_PERCENT) * (temp - MIN_TEMP) / (MAX_TEMP - MIN_TEMP) + MIN_FAN_SPEED_PERCENT;
}
pPixels->fill(pPixels->Color(255,0,0));
pPixels->setBrightness(fanSpeedPercent);
pPixels->show();
pPixelFan->fill(pPixelFan->Color(0,255,0));
pPixelFan->setBrightness(fanSpeedPercent);
pPixelFan->show();
Serial.print(fanSpeedPercent);
Serial.print("%;");
@ -127,5 +128,6 @@ void loop() {
actualFanSpeedRpm = getFanSpeedRpm();
Serial.print(actualFanSpeedRpm);
Serial.println("RPM");
delay(DELAY_TIME);
}