void LCDScreen::updateArrow( double temp ) { lcd.home(); lcd.print( tempFloor ); if ( temp < tempFloor ) temp = tempFloor; int n; //number of spaces to create if ( tempFloor > 99 && tempCeil > 99 ) n = 9; else if ( tempFloor > 99 && tempCeil <= 99 ) n = 10; else if ( tempFloor <= 99 && tempCeil > 99 ) n = 10; else n = 11; int newTemp = map( temp, tempFloor, tempCeil, 0, n ); for ( int o = 0; o < newTemp; o++ ) { lcd.print( "-" ); } lcd.print( ">" ); for ( int o = 0; o < ( n - newTemp); o++ ) { lcd.print( " " ); } lcd.print( tempCeil ); }
void LCDScreen::finalMess() { lcd.clear(); lcd.home(); lcd.print( "PCR complete." ); lcd.setCursor( 0, 1 ); lcd.print( "RESET to cont." ); }
void LCDScreen::dispUserPrefHighLow() { lcd.clear(); lcd.home(); lcd.print( "High: " ); lcd.print( tempCeil ); lcd.setCursor( 0, 1 ); lcd.print( "Low: " ); lcd.print( tempFloor ); }
void LCDScreen::setup() { lcd.begin( 16, 2 ); lcd.home(); lcd.print( "PCR V.2 - O.V.L."); lcd.setCursor( 0, 1 ); lcd.print( "SELECT to cont." ); waitForSelect(); delay( 500 ); setUserInputs(); delay( 500 ); }
void LCDScreen::displayInitialStatus( double temp, int current_cycle ) { lcd.clear(); lcd.home(); updateArrow( temp ); lcd.setCursor( 0, 1 ); lcd.print( "Cycle no. " ); lcd.print( current_cycle ); lcd.print( "/" ); lcd.print( maxCycles ); }
void LCDScreen::printError( int mess ) { lcd.clear(); lcd.home(); String message; if ( mess == 1 ) { message = "ERR: Overheating"; } else if ( mess < 1 ) { message = "ERR: Not ramping"; } else { message = "ERR: wrap failed"; } lcd.print( message ); lcd.setCursor( 0, 1 ); lcd.print( "Check hardware" ); }
int main(int argc, char *argv[]) { Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield(); lcd.begin(16, 2); lcd.setBacklight(RED); lcd.clear(); lcd.home(); lcd.setCursor(0,0); lcd.myPrint("Hello World"); int count = 0; for(int i = 0; i < 20; i++){ usleep(300000); if(count < 5){ lcd.scrollDisplayRight(); } count++; if(count > 5){ lcd.scrollDisplayLeft(); } if(count > 9) count = 0; } uint8_t buttons = lcd.readButtons(); while(!(buttons & BUTTON_SELECT)){ if (buttons) { if (buttons & BUTTON_LEFT) { lcd.scrollDisplayLeft(); lcd.setBacklight(GREEN); } if (buttons & BUTTON_RIGHT) { lcd.scrollDisplayRight(); lcd.setBacklight(TEAL); } } buttons = lcd.readButtons(); usleep(90000); } return 0; }