🇺🇸Adafruit will not be shipping orders on Independence Day Monday 7/4/2022. Please allow extra time for your order to ship and plan accordingly.🇺🇸

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

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);
  if (low_batt < battery_ref) {
     arcada.display->println("low battery");
  } else {
     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.
IMG_7581.jpg (564.11 KiB) Viewed 611 times

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.


Posts: 10158
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.