aboutsummaryrefslogtreecommitdiff
path: root/libraries/LiquidCrystal/examples
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/LiquidCrystal/examples')
-rw-r--r--libraries/LiquidCrystal/examples/HelloWorld/HelloWorld.pde18
-rw-r--r--libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.pde34
2 files changed, 52 insertions, 0 deletions
diff --git a/libraries/LiquidCrystal/examples/HelloWorld/HelloWorld.pde b/libraries/LiquidCrystal/examples/HelloWorld/HelloWorld.pde
new file mode 100644
index 0000000..2f244d0
--- /dev/null
+++ b/libraries/LiquidCrystal/examples/HelloWorld/HelloWorld.pde
@@ -0,0 +1,18 @@
+#include <LiquidCrystal.h>
+
+// LiquidCrystal display with:
+// rs on pin 12
+// rw on pin 11
+// enable on pin 10
+// d4, d5, d6, d7 on pins 5, 4, 3, 2
+LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
+
+void setup()
+{
+ // Print a message to the LCD.
+ lcd.print("hello, world!");
+}
+
+void loop()
+{
+}
diff --git a/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.pde b/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.pde
new file mode 100644
index 0000000..0c4ce35
--- /dev/null
+++ b/libraries/LiquidCrystal/examples/SerialDisplay/SerialDisplay.pde
@@ -0,0 +1,34 @@
+/*
+ * Displays text sent over the serial port (e.g. from the Serial Monitor) on
+ * an attached LCD.
+ */
+
+#include <LiquidCrystal.h>
+
+// LiquidCrystal display with:
+// rs on pin 12
+// rw on pin 11
+// enable on pin 10
+// d4, d5, d6, d7 on pins 5, 4, 3, 2
+LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
+
+void setup()
+{
+ Serial.begin(9600);
+}
+
+void loop()
+{
+ // when characters arrive over the serial port...
+ if (Serial.available()) {
+ // wait a bit for the entire message to arrive
+ delay(100);
+ // clear the screen
+ lcd.clear();
+ // read all the available characters
+ while (Serial.available() > 0) {
+ // display each character to the LCD
+ lcd.write(Serial.read());
+ }
+ }
+}