src/main.cpp
/**************************************************************************************************************************/
// Upate Display Brightness based on ambient light
/**************************************************************************************************************************/
Upate Display Brightness based on ambient light
Upate Display Brightness based on ambient light
void updateDisplayBrightness(){
  int lightReading = analogRead(LIGHT_SENSOR);
  if(lightReading > LIGHT_THRESHOLD_ONE){
    Serial2.write('\x1B');
    Serial2.write('\x2A');
    Serial2.write('\x04');
  }
  else if(lightReading > LIGHT_THRESHOLD_TWO){
    Serial2.write('\x1B');
    Serial2.write('\x2A');
    Serial2.write('\x03');
  }
  else if(lightReading > LIGHT_THRESHOLD_THREE){
    Serial2.write('\x1B');
    Serial2.write('\x2A');
    Serial2.write('\x02'); 
  }
  else{
    Serial2.write('\x1B');
    Serial2.write('\x2A');
    Serial2.write('\x01');
  }
}
void updateDisplayBrightness ( ) { int lightReading = analogRead ( LIGHT_SENSOR ) ; if ( lightReading > LIGHT_THRESHOLD_ONE ) { Serial2 . write ( ' \x1B ' ) ; Serial2 . write ( ' \x2A ' ) ; Serial2 . write ( ' \x04 ' ) ; } else if ( lightReading > LIGHT_THRESHOLD_TWO ) { Serial2 . write ( ' \x1B ' ) ; Serial2 . write ( ' \x2A ' ) ; Serial2 . write ( ' \x03 ' ) ; } else if ( lightReading > LIGHT_THRESHOLD_THREE ) { Serial2 . write ( ' \x1B ' ) ; Serial2 . write ( ' \x2A ' ) ; Serial2 . write ( ' \x02 ' ) ; } else { Serial2 . write ( ' \x1B ' ) ; Serial2 . write ( ' \x2A ' ) ; Serial2 . write ( ' \x01 ' ) ; } }
Upate Display Brightness based on ambient light
Upate Display Brightness based on ambient light
//brightest option - lvl 4 brightness //lvl 3 brightness //lvl 2 brightness //dimmest option - lvl 1 brightness