-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKod.ino
50 lines (45 loc) · 899 Bytes
/
Kod.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
/* Writer: Yunus Emre Aydınlı
Date: 23.02.2020
Nokia 5110 pins;
1
RST – Pin 11
CE – Pin 12
DC – Pin 10
DIN – Pin 9
VCC – Pin 8
BL – Pin 5V
GND – Pin GND
8
HC-SR04 pins;
GND - Pin GND
ECHO - Pin 6
TRİG - Pin 7
VCC - Pin 5V"
*/
#include <LCD5110_Basic.h>
#define trigPin 7
#define echoPin 6
LCD5110 myGLCD(8,9,10,11,12);
extern uint8_t SmallFont[];
extern uint8_t BigNumbers[];
void setup()
{
myGLCD.InitLCD();
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop()
{
myGLCD.setFont(SmallFont);
myGLCD.print("Mesafe:", CENTER, 0);
int sure, mesafe=0;
digitalWrite(trigPin, HIGH);
delayMicroseconds(1000);
digitalWrite(trigPin, LOW);
sure = pulseIn(echoPin, HIGH);
mesafe = sure/58;
myGLCD.setFont(BigNumbers);
myGLCD.printNumI(mesafe,CENTER,16);
delay(450);
myGLCD.clrScr();
}