Moved to other pin
This commit is contained in:
parent
0795dfa0dd
commit
f8c6b4d351
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
#define GPIO_DS18B20 D2 /**< One-Wire used for Dallas temperature sensor */
|
#define GPIO_DS18B20 D2 /**< One-Wire used for Dallas temperature sensor */
|
||||||
|
|
||||||
#define WS2812SINGLE_GPIO_PIN D3
|
#define WS2812SINGLE_GPIO_PIN D5
|
||||||
#define WS2812SINGLE_LEDS 3
|
#define WS2812SINGLE_LEDS 3
|
||||||
|
|
||||||
#define WS2812STRIP_GPIO_PIN D4
|
#define WS2812STRIP_GPIO_PIN D3
|
||||||
#define WS2812STRIP_LEDS 13
|
#define WS2812STRIP_LEDS 13
|
||||||
|
|
||||||
#endif /* End FANLEDCTL_PINS */
|
#endif /* End FANLEDCTL_PINS */
|
@ -16,3 +16,4 @@ framework = arduino
|
|||||||
lib_deps = OneWire
|
lib_deps = OneWire
|
||||||
DallasTemperature
|
DallasTemperature
|
||||||
adafruit/Adafruit NeoPixel
|
adafruit/Adafruit NeoPixel
|
||||||
|
WS2812FX
|
26
src/main.cpp
26
src/main.cpp
@ -1,4 +1,5 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <ESP8266WiFi.h>
|
||||||
#include <DallasTemperature.h>
|
#include <DallasTemperature.h>
|
||||||
#include <OneWire.h>
|
#include <OneWire.h>
|
||||||
#include <Adafruit_NeoPixel.h>
|
#include <Adafruit_NeoPixel.h>
|
||||||
@ -23,8 +24,8 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* LOCAL VARIABLES
|
* LOCAL VARIABLES
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
Adafruit_NeoPixel pixels(WS2812STRIP_LEDS, WS2812STRIP_GPIO_PIN, NEO_RGB + NEO_KHZ400);
|
Adafruit_NeoPixel pixels(WS2812STRIP_LEDS, WS2812STRIP_GPIO_PIN, NEO_RBG + NEO_KHZ400);
|
||||||
Adafruit_NeoPixel singleLed(WS2812SINGLE_LEDS, WS2812SINGLE_GPIO_PIN, NEO_RGB + NEO_KHZ400);
|
Adafruit_NeoPixel singleLed(WS2812SINGLE_LEDS, WS2812SINGLE_GPIO_PIN, NEO_RBG + NEO_KHZ400);
|
||||||
|
|
||||||
OneWire oneWire(GPIO_DS18B20);
|
OneWire oneWire(GPIO_DS18B20);
|
||||||
DallasTemperature sensors(&oneWire);
|
DallasTemperature sensors(&oneWire);
|
||||||
@ -36,6 +37,12 @@ DallasTemperature sensors(&oneWire);
|
|||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
WiFi.mode(WIFI_OFF);
|
||||||
|
if (WiFi.getMode() == WIFI_OFF)
|
||||||
|
{
|
||||||
|
Serial.println(F("\nWifi mode is WIFI_OFF"));
|
||||||
|
}
|
||||||
|
|
||||||
/* Setup FAN Control */
|
/* Setup FAN Control */
|
||||||
pinMode(FAN_PIN, OUTPUT);
|
pinMode(FAN_PIN, OUTPUT);
|
||||||
pinMode(SIGNAL_PIN, INPUT);
|
pinMode(SIGNAL_PIN, INPUT);
|
||||||
@ -63,6 +70,10 @@ void setup() {
|
|||||||
/* prepare LED strip pin */
|
/* prepare LED strip pin */
|
||||||
singleLed.begin();
|
singleLed.begin();
|
||||||
singleLed.clear();
|
singleLed.clear();
|
||||||
|
singleLed.setBrightness(100);
|
||||||
|
singleLed.fill(singleLed.Color(255,0,0));
|
||||||
|
singleLed.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,22 +137,23 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actualFanSpeedRpm = getFanSpeedRpm();
|
||||||
|
|
||||||
pixels.fill(pixels.Color(255, 255,0));
|
pixels.fill(pixels.Color(255, 0,0));
|
||||||
pixels.setBrightness(fanSpeedPercent);
|
pixels.setBrightness(fanSpeedPercent);
|
||||||
pixels.show();
|
pixels.show();
|
||||||
|
|
||||||
singleLed.fill(pixels.Color(0,255,0));
|
|
||||||
singleLed.setBrightness((fanSpeedPercent / 10) % 100);
|
|
||||||
singleLed.show();
|
|
||||||
|
|
||||||
Serial.print(fanSpeedPercent);
|
Serial.print(fanSpeedPercent);
|
||||||
Serial.print("%;");
|
Serial.print("%;");
|
||||||
setFanSpeedPercent(fanSpeedPercent);
|
setFanSpeedPercent(fanSpeedPercent);
|
||||||
|
|
||||||
actualFanSpeedRpm = getFanSpeedRpm();
|
|
||||||
Serial.print(actualFanSpeedRpm);
|
Serial.print(actualFanSpeedRpm);
|
||||||
Serial.println("RPM");
|
Serial.println("RPM");
|
||||||
|
|
||||||
|
singleLed.fill(singleLed.Color(0,128,128));
|
||||||
|
singleLed.setBrightness(255 - (actualFanSpeedRpm / 10));
|
||||||
|
singleLed.show();
|
||||||
|
|
||||||
delay(DELAY_TIME);
|
delay(DELAY_TIME);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user