Changed resistors, R10 not placed, R11 = 10K, R12 = 0R, R13 = 2K2, jumper from pin 26 to R11. Routine to display batt icon finished.

This commit is contained in:
Ricardo
2018-01-30 22:23:17 +00:00
parent a1c19dc44d
commit 57a164bf1f

View File

@@ -48,8 +48,6 @@ void config();
void batt_icon(); void batt_icon();
//volatile byte state = LOW;
// Variables creation // Variables creation
int menuState = 1; // Integer with the number of the menu you are in int menuState = 1; // Integer with the number of the menu you are in
int prevMenu = 1; // Previous menu int prevMenu = 1; // Previous menu
@@ -128,7 +126,6 @@ void setup() { // BEGIN SETUP ------------------------------------
// Timer compare interrupt service routine -------------------------- // Timer compare interrupt service routine --------------------------
ISR(TIMER1_COMPA_vect) // Here we chose between the blinker sequence ISR(TIMER1_COMPA_vect) // Here we chose between the blinker sequence
{ // or to show the temperature on the LEDs { // or to show the temperature on the LEDs
/*
if (!rUP) { if (!rUP) {
if (menuState == 1) { if (menuState == 1) {
menuState = 1; menuState = 1;
@@ -199,21 +196,16 @@ ISR(TIMER1_COMPA_vect) // Here we chose between the blinker sequence
} }
while (!rCANCEL); // Check if button is still pressed do nothing while (!rCANCEL); // Check if button is still pressed do nothing
} }
*/
} }
// ------------------------------------------------------------------- // -------------------------------------------------------------------
void loop() { void loop() {
//digitalWrite(led2, !digitalRead(led2)); // toggle state
batt_val = analogRead(batt); batt_val = analogRead(batt);
display.drawRect(0, 8, 168, 24, BLACK); /* display.drawRect(0, 8, 168, 24, BLACK);
display.display(); display.display();
display.clearDisplay(); display.clearDisplay();
display.setTextSize(1); display.setTextSize(1);
@@ -221,15 +213,10 @@ void loop() {
display.setCursor(50,18); display.setCursor(50,18);
display.println(batt_val); display.println(batt_val);
batt_icon(); batt_icon();
display.display(); display.display(); */
// HERE AGAIN
/*
if (menuState == 1) { if (menuState == 1) {
one(); one();
} }
@@ -254,20 +241,50 @@ void loop() {
else { else {
one(); one();
} }
*/
} }
void batt_icon (void) { void batt_icon (void) {
// Draw the battery icon
display.drawRect(111, 1, 16, 6, WHITE); if (batt_val > 962) {
display.drawPixel(110, 3, WHITE); // Draw the battery icon - Full battery
display.drawPixel(110, 4, WHITE); display.drawRect(111, 1, 16, 6, WHITE);
display.drawPixel(109, 3, WHITE); display.drawRect(112, 2, 14, 4, WHITE);
display.drawPixel(109, 4, WHITE); display.drawRect(113, 3, 12, 2, WHITE);
display.drawPixel(108, 3, WHITE); display.drawPixel(110, 3, WHITE);
display.drawPixel(108, 4, WHITE); display.drawPixel(110, 4, WHITE);
display.drawPixel(109, 3, WHITE);
display.drawPixel(109, 4, WHITE);
display.drawPixel(108, 3, WHITE);
display.drawPixel(108, 4, WHITE);
}
else if ((batt_val > 901) & (batt_val < 962)) {
// Draw the battery icon - Half full battery
display.drawRect(111, 1, 16, 6, WHITE);
display.drawRect(119, 2, 7, 4, WHITE);
display.drawRect(120, 3, 5, 2, WHITE);
display.drawPixel(110, 3, WHITE);
display.drawPixel(110, 4, WHITE);
display.drawPixel(109, 3, WHITE);
display.drawPixel(109, 4, WHITE);
display.drawPixel(108, 3, WHITE);
display.drawPixel(108, 4, WHITE);
}
else {
// Draw the battery icon - Empty battery
display.setCursor(35,1);
display.println("BATT LOW");
display.drawRect(111, 1, 16, 6, WHITE);
display.drawPixel(110, 3, WHITE);
display.drawPixel(110, 4, WHITE);
display.drawPixel(109, 3, WHITE);
display.drawPixel(109, 4, WHITE);
display.drawPixel(108, 3, WHITE);
display.drawPixel(108, 4, WHITE);
}
} }
void zero (void) { void zero (void) {