1
2
3
4
5
6
7
8
9
10
11#include <LiquidCrystal.h>
12
13LiquidCrystal lcd(4, 5, 6, 7, 8, 9);
14
15
16
17#include <SoftwareSerial.h>
18
19SoftwareSerial mySerial (2, 3);
20
21
22
23String val = "No Data";
24
25String oldval;
26
27String newval = "No Data";
28
29int i = 0;
30
31
32
33void setup()
34
35{
36
37
38
39 lcd.begin();
40
41 mySerial.begin(9600);
42
43 Serial.begin(9600);
44
45 lcd.setCursor(0, 0);
46
47 lcd.print(" Digital ");
48
49 lcd.setCursor(0, 1);
50
51 lcd.print(" Notice Board ");
52
53 delay(3000);
54
55 lcd.clear();
56
57}
58
59
60
61void loop()
62
63 {
64
65 val = mySerial.readString();
66
67 val.trim();
68
69 Serial.println(val);
70
71 if(val != oldval)
72
73 {
74
75 newval = val;
76
77 }
78
79 val = oldval;
80
81Serial.println(val);
82
83lcd.clear();
84
85lcd.setCursor(16, 1);
86
87lcd.print(newval);
88
89lcd.setCursor(16, 0);
90
91lcd.print("Notice:");
92
93for(int counter = 0; counter < 24; counter++)
94
95{
96
97lcd.scrollDisplayLeft();
98
99delay(500);
100
101
102
103}
104
105}