hi there,
i have a rotating table which listens to an "S" from serial. this "S" comes from a scannersoftware. when the table gets an "S" it moves 12 times. during this, the rotating table sends some characters to the scannersoftware to trigger some of its functions. when it made full 360 degrees it stops. and waits for another "S" of the scannersoftware.
the program of the turntable works. if i send an "S" with serial monitor, the table behaves as it should.
my problem with my code is that if the table gets another "S", while he is working, it will never stop again. unluckyly the scannersoftware does send additional "S" during its scanning process and i have no influence to change this.
so i am sure there is a simple way of for example let arduino listen to serial only on certain times or flush the lasersoftware "S" out of the communication but i am not clever enough to find it.
i am asking you nice people out there to help me. have a nice day.
void loop(){
if (Serial.available() >0){ // prüft ob Kommunikation möglich
Ser = Serial.read(); // com Port auslesen
}
if (Ser == 'S'){
delay(5000); // ersten Scan abwarten
Serial.println('3'); // auf Texturmenü springen
delay(1500); // warten
Serial.println('G'); // Textur aufnehmen
delay(1000); // warten
Serial.println('4'); // auf SL Menü springen
delay(1500); // warten
Serial.println('A'); // Scan zur Liste hinzufügen
for(int i=0;i<pos;i++){
step(true,stepstogo,500); // Schrittmotor zur nächsten Position bewegen
Serial.println('S'); // nächsten Scan beginnen
delay(5000); // Scan abwarten
Serial.println('3'); // für Textur vorbereiten
delay(1500); // warten
Serial.println('G'); // Textur aufnehmen
delay(1000); // warten
Serial.println('4'); // auf SL Menü springen
delay(1500); // warten
Serial.println('A'); // Scan zur Liste hinzufügen
}
}
}