Skip to content

Instantly share code, notes, and snippets.

@openopen114
Created October 8, 2016 05:08
Show Gist options
  • Save openopen114/78ee09bb8fde7073bfc58cb5b072e96a to your computer and use it in GitHub Desktop.
Save openopen114/78ee09bb8fde7073bfc58cb5b072e96a to your computer and use it in GitHub Desktop.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
void setup() {
//Initialize serial library for transmitting and receiving data via USB
Serial.begin(9600);
lcd.begin(16, 2); //define LCD Size 16 by 2
// lcd line 1
lcd.setCursor(0, 0);
lcd.print("Hello, world!");
// lcd line 2
lcd.setCursor(0, 1);
lcd.print("openopen");
delay(2000);
}
int i = 0;
void loop() {
if (Serial.available() > 0) {
char inputMessage = Serial.read();
lcd.clear();
lcd.setCursor(0, 0); //line 1
lcd.print("temperature:");
lcd.setCursor(0, 1); //line 2
lcd.print(inputMessage);
Serial.print("SlaveValue:");
Serial.println(inputMessage);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment