μInventions
Search…
How to use
To control the LCD itself I recommend reading Adafruit's guide
To control the RGB LEDS you can also follow this guide
Here is the sketch for an Arduino Uno for the Quick Notification Demo.
1
#include <SPI.h>
2
#include <Adafruit_GFX.h>
3
#include <Adafruit_PCD8544.h>
4
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
5
#define RED 8
6
#define GREEN 9
7
bool redLed =1;
8
bool greenLed =1;
9
void setup() {
10
display.begin();
11
display.setContrast(60);
12
display.clearDisplay();
13
pinMode(RED,OUTPUT);
14
pinMode(GREEN,OUTPUT);
15
digitalWrite(RED,1);
16
digitalWrite(GREEN,1);
17
}
18
void displayAlarm(){
19
display.clearDisplay();
20
display.drawRect(0,0,84,48,BLACK);
21
display.drawRect(1,1,82,46,BLACK);
22
display.setTextSize(2);
23
display.setTextColor(BLACK);
24
display.setCursor(12,16);
25
display.println("ALARM");
26
display.display();
27
}
28
void displayOK(){
29
display.clearDisplay();
30
display.drawRect(0,0,84,48,BLACK);
31
display.drawRect(1,1,82,46,BLACK);
32
display.setTextSize(3);
33
display.setTextColor(BLACK);
34
display.setCursor(18,12);
35
display.println("OK!");
36
display.display();
37
}
38
void loop() {
39
displayAlarm();
40
for(int i=0;i<4;i++){
41
digitalWrite(RED,!digitalRead(RED));
42
delay(1000);
43
}
44
displayOK();
45
digitalWrite(GREEN,0);
46
delay(5000);
47
display.clearDisplay();
48
display.display();
49
digitalWrite(GREEN,1);
50
51
}
Copied!
Last modified 1yr ago
Copy link