-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathScroll_Text.ino
More file actions
72 lines (52 loc) · 1.34 KB
/
Copy pathScroll_Text.ino
File metadata and controls
72 lines (52 loc) · 1.34 KB
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
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
pinMode(4, INPUT);
digitalWrite(4, HIGH);
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
// Clear the buffer
display.clearDisplay();
}
void loop() {
if (digitalRead(4) == LOW) {
display.invertDisplay(true);
}
else {
display.invertDisplay(false);
}
//gambarTitik();
menu();
}
void gambarTitik(void) {
int x = analogRead(A6);
x = map(x, 0, 1023, 0, 128);
int y = analogRead(A7);
y = map(y, 0, 1023, 0, 64);
display.clearDisplay();
display.setCursor(0, 0);
display.setTextSize(1);
display.setTextColor(WHITE);
display.println(x);
display.println(y);
display.drawPixel(x, y, WHITE);
display.drawCircle(x, y, 3, WHITE);
display.display();
delay(10);
}
void menu()
{
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println(F("Jancok!!!"));
display.display();
delay(2000);
}