Stop on black line

I bit, this guy will comeback again.. He is like a pigeon, when the :slight_smile: come near the pigeon ,he closes his eyes.. You solve the problem not hide it... :%
Okay, just try:

#include <SerialLCD.h>
#if ARDUINO < 100
#include <NewSoftSerial.h> //this is a must
#else
#include <SoftwareSerial.h>
#endif

SerialLCD slcd(11,12);
int E2 = 5;                         
int M2 = 4;   
int sensorPin = A1; 
int sensorValue = 0;
int value = 250;
int value2 = 0;


void setup() 
{ 

    pinMode(M2, OUTPUT); 
    slcd.begin();
} 

void loop() 
{ 
  
  
  sensorValue = analogRead(sensorPin);
  
  while (sensorValue < 1023) {  // #1
    
  sensorValue = analogRead(sensorPin);
  slcd.clear();
  slcd.setCursor(0, 1);
  slcd.print(sensorValue, DEC);
    
  digitalWrite(M2,LOW);       
  analogWrite(E2, value); 
    
  }
  
  
  
 while (sensorValue > 1023) {  // #2
   
    sensorValue = analogRead(sensorPin);
     slcd.clear();
    slcd.setCursor(0, 1);
    slcd.print(sensorValue, DEC);
    
    digitalWrite(M2,HIGH);      
    analogWrite(E2, value2);   //PWM Speed Control
    
 }}