Go Down

Topic: Artificial Horizon display using a gyro (Read 22099 times) previous topic - next topic



Post a copy of your sketch so I can run it and see what is happening.



Missing pixels in lines is a problem encountered with the new 1.6.12 IDE,  I have updated the ILI9341 library on Github to correct this.



I'm really sorry for the delay, didn't get any forum notifications.

I've updated the library and now it works great! Thank you so much for your support!


i test Demo
// Demo code for artifical horizon display
// Written by Bodmer for a 160 x 128 TFT display
// 15/8/16   https://github.com/Bodmer/TFT_ST7735

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#define TFT_CS     10
#define TFT_RST    9
#define TFT_DC     8
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);
#define TFT_SCLK 13   // set these to be whatever pins you like!
#define TFT_MOSI 11   // set these to be whatever pins you like!

// #include <SPI.h>
// Use ONE of these three highly optimised libraries, comment out other two!
// For S6D02A1 based TFT displays
// #include <TFT_S6D02A1.h>         // Bodmer's graphics and font library for S6D02A1 driver chip
// TFT_S6D02A1 tft = TFT_S6D02A1(); // Invoke library, pins defined in User_Setup.h
//                                    https://github.com/Bodmer/TFT_S6D02A1
// For ST7735 based TFT displays
// #include <TFT_ST7735.h>          // Bodmer's graphics and font library for ST7735 driver chip
// TFT_ST7735 tft = TFT_ST7735();   // Invoke library, pins defined in User_Setup.h
//                                    https://github.com/Bodmer/TFT_ST7735

// For ILI9341 based TFT displays (note sketch is currently setup for a 160 x 128 display)
//#include <TFT_ILI9341.h>         // Bodmer's graphics and font library for ILI9341 driver chip
//TFT_ILI9341 tft = TFT_ILI9341(); // Invoke library, pins defined in User_Setup.h
//                                    https://github.com/Bodmer/TFT_ILI9341
Arduino Version 1.6.12

by Test

C:\Users\Heli\Desktop\Demo_artificial_horizon_7\Demo_artificial_horizon_9.ino:10:95: fatal error: TFT_S6D02A1.h: No such file or directory

 #include <TFT_S6D02A1.h>         // Bodmer's graphics and font library for S6D02A1 driver chip


compilation terminated.

exit status 1
Fehler beim Kompilieren für das Board Arduino/Genuino Uno.
I am a beginner
And look for the error.
For many days

Thanks for any help


Trying to think of things which could slow down a lot of writes to an LCD, I see that you have quite a few pins in use, but ?no? mention of pullup resistors.  Does the screen or adafruit recommend anything ? 
Your code looks as though it is going to presume 30k pullup built in, which might require comms to go slower than their best or be less reliable than ideal, especially if you have more than 6 inches of cabling from microcontroller to display.  Various opinions abound about adding external pullup resistors from a digital pin to arduino Vcc, but I found 10kOhm or 3.3kOhm more likely to work than none at all and necessary when using a few feet of cables.


Was a copy error.
There was wrong data in the file.
For whatever reason.


hm work only with Arduino Duo
i have Arduino Due  ;o(
But it is fine



As you are a beginner I would start by creating a simpler sketch! For example just draw a line though the centre of the screen at an angle that is output by the sensor.  You will need to store the end coordinates of the last drawn line so you can erase it by over-writing with background before drawing the new line.


Hi there ...
Does anyone here?
I want to run this code for horizon indicator, any other updates?
Hey guys, is this topic active?


Hello Bodmer:

I have been using your TFT eSPI library with a M5stack ESP32 320x240. Works quite well ! I was wondering - why not make a artificial horizon indicator using the sprites. The pitch scale and sky+earth image would be replotted as a sprite with the wings symbol static (along with other features). What do you think ?



I did try this and it works. I will tidy up the sketch and include it as an example. I also created a simple animated compass with moving needle and dial which I might add.


Very good. Can you send me the example ? Does not matter if it is not too finished - it will a good exercise to figure out how you did this ! Thanks.


Hello BOdmer! I am using the ILI9341_due Library and the same solved problem on  post #46 appears again. Can you help me? Som missed pixels in the border of moving Indicator.



Would this code be hard to convert to be used on a higher resolution display (in order to show some other values out of the AH) and with a STM32 board?


Hello Bodmer. Any chance of getting the sprite example. Confused about how the sprite programming works. Thanks

Go Up