#include<LiquidCrystal.h>
LiquidCrystal lcd(8,7,6,5,4,3);
#define irsensor 2
byte ch;
int col=0;
int row=0;
int sensordeger;
int durum=0;
int sayac=0;
void setup() {
pinMode(irsensor,INPUT);
Serial.begin(9600);
lcd.begin(16,2);
lcd.clear();
// put your setup code here, to run once:
}
void loop() {
sensordeger=digitalRead(irsensor);
if (sensordeger==0){
if(durum==0){
sayac++;
durum=1;
Serial.print("Sayac: ");
Serial.println(sayac);
}
}
if(Serial.available()){
char ch=Serial.read();
Serial.write(ch);
Serial.println();
lcd.setCursor(col,row);
lcd.write(ch);
col++;
}
if(col>15){
row++;
col=0;
lcd.write(ch);
}
if(ch=='*' ||row==1&&col>=15){
lcd.clear();
col=0;
row=0;
}
}