Dodanie neopixels
This commit is contained in:
@@ -3,9 +3,13 @@
|
|||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
#include <Adafruit_SSD1306.h>
|
#include <Adafruit_SSD1306.h>
|
||||||
#include "DHT.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
|
#define DHTTYPE DHT22
|
||||||
|
|
||||||
@@ -25,11 +29,13 @@
|
|||||||
|
|
||||||
#define DHTPIN 4 //GPIO04 D4
|
#define DHTPIN 4 //GPIO04 D4
|
||||||
|
|
||||||
#define LED_WHT_TANK 26 //GPIO04 D26
|
#define LED_WHT_TANK 26 //GPIO26 D26
|
||||||
#define LED_RED_TANK 25 //GPIO04 D25
|
#define LED_RED_TANK 25 //GPIO25 D25
|
||||||
|
|
||||||
|
#define NEOPIXEL 27 //GPIO04 D27
|
||||||
|
|
||||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||||
|
Adafruit_NeoPixel pixels(NUMPIXELS, NEOPIXEL, NEO_GRB + NEO_KHZ800);
|
||||||
DHT dht(DHTPIN, DHTTYPE);
|
DHT dht(DHTPIN, DHTTYPE);
|
||||||
|
|
||||||
|
|
||||||
@@ -60,6 +66,8 @@ void setup() {
|
|||||||
pinMode(PIN_SPEED_1, OUTPUT);
|
pinMode(PIN_SPEED_1, OUTPUT);
|
||||||
pinMode(PIN_SPEED_2, OUTPUT);
|
pinMode(PIN_SPEED_2, OUTPUT);
|
||||||
dht.begin();
|
dht.begin();
|
||||||
|
pixels.begin();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
@@ -91,10 +99,45 @@ void loop() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
temp = (dht.readTemperature());
|
temp = (dht.readTemperature());
|
||||||
display.setCursor(0, 20);
|
display.setCursor(0, 20);
|
||||||
display.println(temp);
|
display.println(temp);
|
||||||
|
|
||||||
display.display();
|
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