#include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); const int buttonPin = 0; // the number of the pushbutton pin const int ledPin = A1; // the number of the LED pin int clicks = 0; // variables will change: int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); lcd.setCursor(1, 1); lcd.print("Write plese"); lcd.begin(16, 2); } void loop(){ // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: if (buttonWasUp && !digitalRead(BUTTON_PIN)) { delay(10); digitalWrite(ledPin, HIGH); lcd.clear(); lcd.cursor(); lcd.blink(); delay(1000); lcd.setCursor(2, 2); lcd.print("Write plese"); delay(1000); } else { lcd.cursor(); lcd.blink(); lcd.clear(); lcd.setCursor(0, 0); lcd.print("1"); delay(99999999); } }

Теги других блогов: Arduino LCD кнопка