-
Notifications
You must be signed in to change notification settings - Fork 16
/
ST7567S_128X64_I2C.ino
112 lines (92 loc) · 3.05 KB
/
ST7567S_128X64_I2C.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/******************************
* original code from
* URL: https://github.com/mworkfun/ST7567A_128X32DOT_LCD
*
*
* Modify for LCD ST7567S 128x64
* screen:
* x-----------------------> +
* y |
* | |
* |---------------------
* |
* v +
*
******************************/
#include"lcd_st7567s.h"
//create an lcd object.
lcd_st7567s Lcd;
/////////////////////////////////////////////////////////
void setup() {
//Serial.begin(115200);
Lcd.Init();
}
/////////////////////////////////////////////////////////
void loop() {
Lcd.testPixel(2); //use to test LCD screen. Parameter is velocity.
for(int a=0; a<64; a++){
Lcd.DisplayPixel(a,a); //display one pixel. X=0-31, Y=0-127
delay(5);
}
for(int a=0; a<64; a++){
Lcd.ClearPixel(a,a); //Does not display a pixel. X=0-31, Y=0-127
delay(5);
}
Lcd.Clear(true);
for(int a=0; a<64; a++){
Lcd.ClearPixel(a,a); //Does not display a pixel. X=0-31, Y=0-127
delay(5);
}
delay(5000);
Lcd.Clear(false);
for(int a=0; a<128; a++){
Lcd.DisplayPixel(a,0); //display one pixel. X=0-31, Y=0-127
Lcd.DisplayPixel(a,63); //display one pixel. X=0-31, Y=0-127
}
for(int a=0; a<64; a++){
Lcd.DisplayPixel(0, a); //display one pixel. X=0-31, Y=0-127
Lcd.DisplayPixel(127,a); //display one pixel. X=0-31, Y=0-127
Lcd.DisplayPixel(4,a);
}
Lcd.DrawLine(5, 5, 125, 60, false);
Lcd.DrawLine(125, 5, 5, 60, false);
Lcd.DrawLine(53, 31, 73, 31, false);
Lcd.DrawLine(63, 20, 63, 40, false);
Lcd.draw_circle(20, 30, 10, DRAW_ALL, false, false);
Lcd.draw_circle(20, 30, 15, DRAW_ALL, false, false);
Lcd.draw_circle(105, 30, 15, DRAW_ALL, false, true);
delay(5000);
Lcd.Clear(false);
Lcd.DrawLine(53, 31, 73, 31, false);
Lcd.DrawLine(63, 20, 63, 40, false);
Lcd.draw_circle(90, 30, 10, DRAW_ALL, false, false);
Lcd.draw_circle(30, 30, 10, DRAW_ALL, false, true);
delay(5000);
Lcd.Clear(true);
Lcd.DrawLine(53, 31, 73, 31, true);
Lcd.DrawLine(63, 20, 63, 40, true);
Lcd.draw_circle(90, 30, 10, DRAW_ALL, true, false);
Lcd.draw_circle(30, 30, 10, DRAW_ALL, true, true);
delay(5000);
/**/
Lcd.Cursor(7, 0); //Character display position. y=0-3, x=0-17
Lcd.Display("KEYES"); //Maximun 18 characters.
Lcd.Cursor(0, 1);
Lcd.Display("ABCDEFGHIJKLMNOPQR");
Lcd.Cursor(0, 2);
Lcd.Display("123456789+-*/<>=$@");
Lcd.Cursor(0, 3);
Lcd.Display("%^&(){}:;'|?,.~\\[]");
Lcd.Cursor(0, 4);
Lcd.Display("ABCDEFGHIJKLMNOPQR");
Lcd.Cursor(0, 5);
Lcd.Display("123456789+-*/<>=$@");
Lcd.Cursor(0, 6);
Lcd.Display("%^&(){}:;'|?,.~\\[]");
Lcd.Cursor(0, 7);
Lcd.Display("ABCDEFGHIJKLMNOPQR");
delay(5000);
Lcd.Clear(false); //All pixels turn off.
Lcd.DisplayPicture(); //Displays the image data for the picture.c file
delay(5000);
}