Added second LED library
This commit is contained in:
parent
e56a3a381d
commit
c48d977f42
@ -19,4 +19,7 @@
|
|||||||
#define GPIO_WS2812_PIN1 D3
|
#define GPIO_WS2812_PIN1 D3
|
||||||
#define WS2812_LEDS1 1
|
#define WS2812_LEDS1 1
|
||||||
|
|
||||||
|
#define GPIO_WS2812_PIN2 D4
|
||||||
|
#define WS2812_LEDS2 10
|
||||||
|
|
||||||
#endif /* End FANLEDCTL_PINS */
|
#endif /* End FANLEDCTL_PINS */
|
26
src/main.cpp
26
src/main.cpp
@ -20,7 +20,9 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* LOCAL VARIABLES
|
* LOCAL VARIABLES
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
Adafruit_NeoPixel* pPixels = NULL;
|
Adafruit_NeoPixel* pPixelFan = NULL;
|
||||||
|
Adafruit_NeoPixel* pPixel = NULL;
|
||||||
|
|
||||||
OneWire oneWire(GPIO_DS18B20);
|
OneWire oneWire(GPIO_DS18B20);
|
||||||
DallasTemperature sensors(&oneWire);
|
DallasTemperature sensors(&oneWire);
|
||||||
|
|
||||||
@ -36,16 +38,15 @@ void setup() {
|
|||||||
pinMode(SIGNAL_PIN, INPUT);
|
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();
|
pPixelFan->begin();
|
||||||
pPixels->clear();
|
pPixelFan->clear();
|
||||||
pPixels->fill(pPixels->Color(255,0,0));
|
pPixelFan->fill(pPixelFan->Color(255,0,0));
|
||||||
pPixels->setBrightness(100);
|
pPixelFan->setBrightness(100);
|
||||||
pPixels->show();
|
pPixelFan->show();
|
||||||
|
|
||||||
|
/* Initialize Temperature sensor */
|
||||||
/* Initialize Temperature sensor */
|
|
||||||
sensors.begin();
|
sensors.begin();
|
||||||
for(int j=0; j < TEMP_SENSOR_MEASURE_SERIES && sensors.getDeviceCount() == 0; j++)
|
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;
|
fanSpeedPercent = (100 - MIN_FAN_SPEED_PERCENT) * (temp - MIN_TEMP) / (MAX_TEMP - MIN_TEMP) + MIN_FAN_SPEED_PERCENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPixels->fill(pPixels->Color(255,0,0));
|
pPixelFan->fill(pPixelFan->Color(0,255,0));
|
||||||
pPixels->setBrightness(fanSpeedPercent);
|
pPixelFan->setBrightness(fanSpeedPercent);
|
||||||
pPixels->show();
|
pPixelFan->show();
|
||||||
|
|
||||||
Serial.print(fanSpeedPercent);
|
Serial.print(fanSpeedPercent);
|
||||||
Serial.print("%;");
|
Serial.print("%;");
|
||||||
@ -127,5 +128,6 @@ void loop() {
|
|||||||
actualFanSpeedRpm = getFanSpeedRpm();
|
actualFanSpeedRpm = getFanSpeedRpm();
|
||||||
Serial.print(actualFanSpeedRpm);
|
Serial.print(actualFanSpeedRpm);
|
||||||
Serial.println("RPM");
|
Serial.println("RPM");
|
||||||
|
|
||||||
delay(DELAY_TIME);
|
delay(DELAY_TIME);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user