-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
70 lines (61 loc) · 1.67 KB
/
main.cpp
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
#include <iostream>
#include "ssd1306_rpi_i2c.h"
#include <thread>
int main(int argc, char *argv[])
{
static_cast<void>(argc);
static_cast<void>(argv);
ssd1306_rpi::SSD1306_RPI_I2C oled;
if(oled.open_i2c("/dev/i2c-1", 0x3C))
{
std::cout << "OLED i2C opened!" << std::endl;
oled.init_display();
//oled.draw_text("W#12", 23,16);
//oled.draw_line(10,12,25,12);
}
oled.set_draw_mode(ssd1306_rpi::Draw_Mode::On_call_display);
oled.draw_text("Hello-world", 10,10);
//oled.draw_text("Hello", 30,20);
oled.display();
oled.inverse_display(true);
//oled.scroll_right();
// bool inv=true;
// for(;;)
// {
// oled.inverse_display(inv);
// inv = !inv;
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
// }
// for(uint i=0; i<50; ++i)
// {
// std::string str("Temp=");
// str.append(std::to_string(i));
// oled.draw_text(str, 20, 32);
// oled.draw_line(5, i, 100,i);
// oled.display();
// std::this_thread::sleep_for(std::chrono::milliseconds(50));
// }
// oled.draw_text("ABBBBBCCCCC", 20, 20);
// oled.display();
// uint16_t contrast=0;
// bool up=true;
// for(;;)
// {
// if(up)
// {
// ++contrast;
// if(contrast>=0x7F)
// up=false;
// }
// else
// {
// --contrast;
// if(contrast==0)
// up=true;
// }
// std::cout << "contrast: " << contrast << std::endl;
// oled.set_contrast(contrast);
// std::this_thread::sleep_for(std::chrono::milliseconds(10));
// }
return 0;
}