/* Lab Trial Test 2
* Name: Phyo Wai Lwin
* Class:DEE1
* Date:12/07/2024
*/
int LEDState = 1;
long previousMillis = 0;
int interval = 2000 ;
long previousMillisAnalog=0;
int intervalAnalog=500;
void setup()
{
Serial.begin(115200);
pinMode(23, OUTPUT);
}
void loop()
{
long currentMillis = millis();
if ( currentMillis - previousMillis >= interval)
{
previousMillis = currentMillis;
if (LEDState == LOW)
{
LEDState = HIGH;
}
else
{
LEDState = LOW;
}
digitalWrite(23, LEDState);
}
if ( currentMillis - previousMillisAnalog >= intervalAnalog)
{
previousMillisAnalog = currentMillis;
{
int adcRes = analogRead(A5);
Serial.print("The adc reading is ");
Serial.println( adcRes );
}
}
}