Another project¶
Research¶
A couple weeks ago I bought Arduino UNO Starter Kit (price 99,90€) and Arduino MKR IoT Bundle (price 94,90€). First I tried code smartphone application to send text via WiFi. I used MIT App Inventor. But that was not success. So I desided to use serial bus to send text to Arduino LCD display.
I found some projects. My project based on Circuit Basics site.
Plan to workflows
Shortly: How to send text to Arduino LCD display?
Plan to workflows
- [ ] Research
- [ ] Platform building
- [ ] Coding and testing
- [ ] Conclusion
Platform¶
This is my plan to platform such as hardware and Arduino Software(IDE). I build hardware as plan and it went very well.
Coding and testing¶
1.0 Step: How to write text to LCD display¶
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
}
void loop() {
lcd.print("Hi FabAcademy");
delay(500);
lcd.clear();
delay(500);
}
The goal is done
2.1 Step: How to write text to LCD display on live using Arduino Software(IDE) Serial monitor.¶
Goal: How to ride text to LCD display on live using Arduino Software(IDE) Serial monitor.
# include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int incomingByte = 0;
String a;
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
lcd.begin(16, 2);
lcd.print("M:");
}
void loop() {
if (Serial.available() > 0) {
incomingByte = Serial.read(); // read the incoming byte:
a=Serial.readStringUntil('\r'); // ('/r')read the incoming text. Until CR (Carriage Return)('\n')
Serial.print(" I :");
Serial.println(a);
Serial.println(incomingByte);
lcd.print(incomingByte);
lcd.print(a);
}
}
Result:
After loading
Open Serial monitor. Type ‘g’ and press Send key
Result:
On LCD display you can see
- M: (ok)
- 103 (ok)
- Tree horisontal lines (on this shoud be letter g)
On Serial monitor
- 12:44:06.058 -> I : (ok)
- 12:44:06.058 -> (on this shoud be letter g)
- 12:44:06.099 -> 103 (ok)
So, my code is not recognise that g is text. I have solve that problems asap.
A couple days laiter on friday 15.5.2020 found solution on page:
https://www.c-sharpcorner.com/article/how-to-display-message-on-lcd-using-serial-monitor-of-ardunio/
Now it is running smoothly.
# include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
lcd.begin(16, 2);
}
void loop() {
if (Serial.available()) {
delay (600);
lcd.write(Serial.read());
}
}
Conclusion¶
- First, breadboard is little bit Unstable platform. One wire was unfastened on while.
- MIT App Inventor was very interesting app. “I’ll be back”
- Note: It coud be possible send tex using html site on your PC.