0

Clearing the data from the screen
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Clearing the data from the screen

by dkanday on Wed Jun 16, 2021 4:57 pm

Hi,
I am using the audrino version for the clue and I am using an if else condition where I am making the font color go red with a text "low battery" when the input voltage on a particular analog pin goes to 0 and make the font go green with the text "good battery".
During the change of state and after the state of the pin chnages state, I see that clue still holds on the last text and color.
For example, if the analog pin went from low to high, the new screen data shows overlapping green and red text with low and good battery. I am using all the latest library and clue firmware.
is there something that I need to add to clear the old data in the clue code. I am using the arcada_clue_test example to build my code.
Find attached is the image for reference.
Code snippet:

Code: Select all | TOGGLE FULL SIZE
  //D v6
  int batt_ref_pin=A6; // D v6-> pin A6 connected to the vesc temp pin
  int battery_ref=80; // D v6-> comparing it to less than 0.3V
  int low_batt;

  low_batt= analogRead(batt_ref_pin);
  //Serial.println(low_batt);
  //delay(delayTime);
  if (low_batt < battery_ref) {
     arcada.display->setTextColor(ARCADA_RED);
     arcada.display->println("low battery");
  } else {
     arcada.display->setTextColor(ARCADA_GREEN);
     arcada.display->println("Good battery");
  }


When I used this above logic in circuitpython it was able to determine and display correctly.
Any help is greatly appreciated.
Attachments
IMG_7581.jpg
IMG_7581.jpg (564.11 KiB) Viewed 187 times

dkanday
 
Posts: 60
Joined: Mon Jun 07, 2021 4:49 pm

Re: Clearing the data from the screen

by dastels on Wed Jun 16, 2021 5:23 pm

You could use void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); in the Adafruit_GFX class (using black as the color) to clear the space.

Dave

dastels
 
Posts: 7547
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.