Hello guys,
i would lik to build a mini artificial Horizon display for a model airplane.
the code should take roll + pitch angles from an MPU6050 and display an articial horizon "ball" similar to that of an aircraft.
im using the SPI 1.8" display, and managed to build a static display of pitch = 0 roll = 0, similar to the attached picture.
so far im trying to run the diaply with variable angles, without the gyro, just for making sure i have the display running well.
im using the Adafruit ST7735 library, and i can fill parts of the screen with tft.fillRoundRect function, but i can not get how to fill "angled" parts of the screen.
i managed to get a code running just the Artifical horizon line using DrawLine:
for (int16_t y=0; y < 10; y++)
{
for (int16_t x=40; x < 120; x++)
{
tft.drawLine(0, x, 130, 160-x, color); // startx, start y, stop x, stop y
tft.drawLine(0, x, 130, 160-x, ST7735_BLACK); // startx, start y, stop x, stop y
}
for (int16_t x=120; x >40; x--)
{
tft.drawLine(0, x, 130, 160-x, color); // startx, start y, stop x, stop y
tft.drawLine(0, x, 130, 160-x, ST7735_BLACK); // startx, start y, stop x, stop y
}
// tft.drawLine(0, 70, 130, 90, color); // startx, start y, stop x, stop y
}
}
but how do i fill the screen in color above and below that line?
under that line should be brown, and above it blue.
also, in order to get just one line on the screen at all times, i have to "delete" the line by drawing a black line over it, this wont work with full color background.
basically what im trying to get is a code like the piece of code i added, but above the line all blue, under the line all brown.
any ideas?
thanks.