This is an Abstract from my program
switch(buf[1]){
case startRecord:
display.clearDisplay();
sensorValue = analogRead(sensorPin);
display.setCursor(30,0);
display.setTextSize(1);
display.print("LDR Reading:");
display.setCursor(30,10);
display.setTextSize(2);
display.print(sensorValue);
delay(500);
display.display();
break;
case endRecord:
display.clearDisplay();
display.setCursor(20,10);
display.setTextSize(1);
display.print("Waiting for Input");
display.display();
break;
default:
Serial.println("Record function undefined");
break;
}
In case 1, I would like to print the values of LDR after every half a second until the user inputs the second command which prompts the second case.
The display is done on OLED , hence the functions like display.display() etc are present in the program.
Can somebody tell me where should I place the loop in case 1 and where should I place the break statement?
Thanks in advance