Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- // initialize the library by associating any needed LCD interface pin
- // with the arduino pin number it is connected to
- const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
- LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
- //const int buttonPin2 = 2; // the number of the pushbutton pin
- //const int buttonPin3 = 3; // the number of the pushbutton pin
- //const int buttonPin4 = 4; // the number of the pushbutton pin
- const int buttonPin8 = 8; // the number of the pushbutton pin
- int buttonState = 0; // variable for reading the pushbutton status
- // Возвращаем отправленное значение
- void setup() {
- // set up the LCD's number of columns and rows:
- lcd.begin(16, 2);
- pinMode(buttonPin8, INPUT);
- // initialize the serial communications:
- Serial.begin(9600);
- }
- void loop() {
- // read the state of the pushbutton value:
- buttonState = digitalRead(buttonPin8);
- if (buttonState == HIGH) {
- //send command to smif
- Serial.println("Send 5");
- }
- // 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
- char readData = Serial.read();
- if (readData != 10 && readData != 13) {
- lcd.write(readData);
- }
- }
- }
- delay(200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement