Dodanie neopixels
This commit is contained in:
@@ -3,9 +3,13 @@
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#include "DHT.h"
|
||||
#include <Adafruit_NeoPixel.h>
|
||||
|
||||
|
||||
#define Version "0.1"
|
||||
#define Version "0.3"
|
||||
|
||||
|
||||
#define NUMPIXELS 1 //docelowo 8-9
|
||||
|
||||
#define DHTTYPE DHT22
|
||||
|
||||
@@ -15,21 +19,23 @@
|
||||
#define OLED_RESET -1
|
||||
#define SCREEN_ADDRESS 0x3C
|
||||
|
||||
#define BTN_RST 35 //GPIO35 D35
|
||||
#define BTN_DIMM 34 //GPIO34 D34
|
||||
#define BTN_SPEED 39 //GPIO35 VN
|
||||
#define BTN_HYGRSTT 36 //GPIO36 VP
|
||||
#define BTN_RST 35 //GPIO35 D35
|
||||
#define BTN_DIMM 34 //GPIO34 D34
|
||||
#define BTN_SPEED 39 //GPIO35 VN
|
||||
#define BTN_HYGRSTT 36 //GPIO36 VP
|
||||
|
||||
#define PIN_SPEED_1 32 //GPIO32 D32
|
||||
#define PIN_SPEED_2 14 //GPIO36 D14
|
||||
#define PIN_SPEED_1 32 //GPIO32 D32
|
||||
#define PIN_SPEED_2 14 //GPIO36 D14
|
||||
|
||||
#define DHTPIN 4 //GPIO04 D4
|
||||
#define DHTPIN 4 //GPIO04 D4
|
||||
|
||||
#define LED_WHT_TANK 26 //GPIO04 D26
|
||||
#define LED_RED_TANK 25 //GPIO04 D25
|
||||
#define LED_WHT_TANK 26 //GPIO26 D26
|
||||
#define LED_RED_TANK 25 //GPIO25 D25
|
||||
|
||||
#define NEOPIXEL 27 //GPIO04 D27
|
||||
|
||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||
Adafruit_NeoPixel pixels(NUMPIXELS, NEOPIXEL, NEO_GRB + NEO_KHZ800);
|
||||
DHT dht(DHTPIN, DHTTYPE);
|
||||
|
||||
|
||||
@@ -60,6 +66,8 @@ void setup() {
|
||||
pinMode(PIN_SPEED_1, OUTPUT);
|
||||
pinMode(PIN_SPEED_2, OUTPUT);
|
||||
dht.begin();
|
||||
pixels.begin();
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@@ -91,10 +99,45 @@ void loop() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
temp = (dht.readTemperature());
|
||||
display.setCursor(0, 20);
|
||||
display.println(temp);
|
||||
|
||||
display.display();
|
||||
delay(100);
|
||||
|
||||
// #################################################################
|
||||
// #################################################################
|
||||
//NEOPIXELS
|
||||
// #################################################################
|
||||
// #################################################################
|
||||
pixels.clear();
|
||||
|
||||
pixels.setPixelColor(0, pixels.Color(10, 0, 0));
|
||||
pixels.show();
|
||||
delay(500);
|
||||
pixels.setPixelColor(0, pixels.Color(0, 10, 0));
|
||||
pixels.show();
|
||||
delay(500);
|
||||
pixels.setPixelColor(0, pixels.Color(0, 0, 10));
|
||||
pixels.show();
|
||||
delay(500);
|
||||
pixels.setPixelColor(0, pixels.Color(10, 10, 0));
|
||||
pixels.show();
|
||||
delay(500);
|
||||
pixels.setPixelColor(0, pixels.Color(0, 10, 10));
|
||||
pixels.show();
|
||||
delay(500);
|
||||
pixels.setPixelColor(0, pixels.Color(10, 0, 10));
|
||||
pixels.show();
|
||||
delay(500);
|
||||
pixels.setPixelColor(0, pixels.Color(10, 10, 10));
|
||||
pixels.show();
|
||||
delay(1300);
|
||||
|
||||
|
||||
delay(300);
|
||||
digitalWrite(PIN_SPEED_1, LOW);
|
||||
digitalWrite(PIN_SPEED_2, LOW);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user