Components and supplies
1.8" TFT SPI LCD Screen with MicroSD Socket
Arduino Proto Shield
gps neo 6m
Jumper (Busbar), Jumper Leads Set
Arduino UNO
Tools and machines
Solder Wire, Lead Free
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Soldering iron (generic)
Project description
Code
sauvegarde SD
arduino
data logger
1#include <SPI.h> 2#include<SD.h> 3#include <Adafruit_GFX.h> 4#include <Adafruit_ST7735.h> 5#define cs 10 6#define dc 9 7#define rst 8 8#include <TinyGPS++.h> 9#include <SoftwareSerial.h> 10Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst); 11static const int RXPin = 4, TXPin = 3; //GPS communication 12static const uint32_t GPSBaud = 9600; 13const int cs_sd=4; 14#define OLED_RESET 5 15 16 17 18TinyGPSPlus gps; 19SoftwareSerial ss(RXPin, TXPin); 20 21int x=80; 22int xh=80; 23int maxhigh=0; 24int maxspeed = 0, speed1 = 0; 25int high1 = 0;; 26 27 28void setup() 29{ 30 31 Serial.begin(9600); 32 ss.begin(GPSBaud); 33 tft.initR(INITR_GREENTAB); 34 tft.fillScreen(ST7735_BLACK); 35 tft.setCursor(5, 58); 36 tft.setTextSize(1); 37 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 38 tft.print("initilisation"); 39 tft.setCursor(5, 70); 40 tft.print("init SD"); 41 delay(1000); 42 if(!SD.begin(cs_sd)) //Condition vrifiant si la carte SD est prsente dans l'appareil 43 { 44 tft.setCursor(5, 82); 45 tft.print("Defaut SD"); 46 return; 47 } 48 tft.setCursor(5, 82); 49 tft.print("Carte SD OK"); 50 51 delay(1000); 52 tft.fillScreen(ST7735_BLACK); 53 54 File data = SD.open("donnees.txt",FILE_WRITE); // Ouvre le fichier "donnees.txt" 55 data.println(""); data.println("Dmarrage acquisition"); // Ecrit dans ce fichier 56 data.close(); 57 58 59 60} 61 62void loop() 63{ 64 65 tft.setTextSize(1); 66 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 67 68 // affichage des informations a chaque bonne reception satellite 69 while (ss.available() > 0){ 70 gps.encode(ss.read()); 71 if (gps.location.isUpdated()){ 72 73 cadre(); 74 75 76 77 78 79 tft.setCursor(5, 44); 80 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 81 tft.print("Latitude :"); 82 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 83 tft.print(gps.location.lat(), 6); 84 tft.setCursor(5, 58); 85 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 86 tft.print("Longitude :"); 87 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 88 tft.print(gps.location.lng(), 6); 89 90 91 92 93 94 95 96 //affichage ecran date 97 tft.setCursor(5, 7); 98 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 99 tft.print("date : "); 100 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 101 tft.print(gps.date.day()); 102 tft.print(" "); 103 tft.print(gps.date.month()); 104 tft.print(" "); 105 tft.print(gps.date.year()); 106 107 String Date=String(gps.date.day())+(" ")+(gps.date.month())+(" ")+(gps.date.year()); 108 109 110 //affichage ecran heure 111 tft.setCursor(5, 20); 112 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 113 tft.print("heure : "); 114 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 115 tft.print(gps.time.hour()+1); 116 tft.print(" "); 117 tft.print(gps.time.minute()); 118 tft.print(" "); 119 tft.print(gps.time.second()); 120 tft.print(" "); 121 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 122 tft.setCursor(3, 30); 123 124 String Temps=String(gps.time.hour()+1)+(" ")+(gps.time.minute())+(" ")+(gps.time.second()); 125 126 127 128 //affichage ecran altitude 129 tft.setCursor(5, 80); 130 tft.print("H m :"); 131 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 132 tft.print (gps.altitude.meters(),0); 133 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 134 tft.print(" "); 135 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 136 tft.setCursor(5, 95); 137 hmax(); 138 tft.print("Hmax :"); 139 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 140 tft.print(maxhigh); 141 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 142 tft.print(" "); 143 courbeh(); 144 145 146 //affichage ecran vitesse 147 tft.setCursor(5, 115); 148 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 149 tft.print("V act: "); 150 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 151 tft.print (gps.speed.kmph(),0); 152 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 153 tft.print(" "); 154 tft.setCursor(5, 130); 155 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 156 vmax(); 157 tft.print("vmax: "); 158 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 159 tft.print(maxspeed); 160 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 161 tft.print(" "); 162 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 163 courbe(); 164 165 166 167 168 //affichage ecran nombre de satellites 169 tft.setCursor(5, 147); 170 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 171 tft.print("nombre de Sat : "); 172 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 173 tft.print(gps.satellites.value()); 174 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 175 tft.print(" "); 176 177 // Horizontal Dim. of Precision (100ths-i32) 178 Serial.print("HDOP = "); 179 Serial.println(gps.hdop.value()); 180 181 182 183 184 185 186 187 smartDelay(400); 188 189 // Ecriture des donnes dans le fichier texte 190 File data=SD.open("donnees.txt",FILE_WRITE); 191 data.println(Date + " " + Temps + " " + String(gps.location.lat(), 6)+" "+String(gps.location.lng(), 6)+(" ")+String(gps.altitude.meters(),0)+(" ")+String(maxhigh)+(" ")+String(gps.speed.kmph(),0)+(" ")+String(maxspeed)); 192 data.close(); 193 194} 195 } 196} 197// delai pour une bonne recption 198static void smartDelay(unsigned long ms) 199{ 200 unsigned long start = millis(); 201 do 202 { 203 while (ss.available()) 204 gps.encode(ss.read()); 205 } while (millis() - start < ms); 206} 207void cadre() { 208 // affichage ecran 209 //cadre 210 tft.drawLine(0,0,130,0,ST7735_RED); 211 tft.drawLine(0,1,130,1,ST7735_RED); 212 tft.drawLine(0,158,130,158,ST7735_RED); 213 tft.drawLine(0,142,130,142,ST7735_RED); 214 tft.drawLine(0,141,130,141,ST7735_RED); 215 tft.drawLine(0,107,130,107,ST7735_RED); 216 tft.drawLine(0,108,130,108,ST7735_RED); 217 218 tft.drawLine(80,108,80,140,ST7735_RED); 219 tft.drawLine(81,109,81,140,ST7735_RED); 220 221 tft.drawLine(80,70,80,108,ST7735_RED); 222 tft.drawLine(81,70,81,108,ST7735_RED); 223 224 tft.drawLine(0,159,130,159,ST7735_RED); 225 tft.drawLine(0,0,0,156,ST7735_RED); 226 tft.drawLine(1,1,1,157,ST7735_RED); 227 tft.drawLine(127,0,127,156,ST7735_RED); 228 tft.drawLine(126,0,126,156,ST7735_RED); 229 tft.drawLine(0,35,130,35,ST7735_RED); 230 tft.drawLine(0,36,130,36,ST7735_RED); 231 tft.drawLine(0,70,130,70,ST7735_RED); 232 tft.drawLine(0,71,130,71,ST7735_RED); 233 234} 235 236void courbe() { 237 238 239 int nouvelleValeur; 240 241 // converison vitesse max (350 km/h) en pixel 242 nouvelleValeur = map((gps.speed.kmph()), 0, 150, 137, 110); // car l'cran a 64 pixels de haut 243 244 245 x++; 246 247 tft.drawPixel(x,nouvelleValeur,ST7735_CYAN); 248 if (x>123) { 249 x=80; 250 tft.fillRect(82,110,43,30,ST7735_BLACK); 251 252 } 253} 254void courbeh() { 255 256 257 int nouvelleValeurh; 258 259 // converison vitesse max (350 km/h) en pixel 260 nouvelleValeurh = map((gps.altitude.meters()), 0, 1000, 104, 72); // car l'cran a 64 pixels de haut 261 262 263 xh++; 264 265 tft.drawPixel(xh,nouvelleValeurh,ST7735_CYAN); 266 if (xh>123) { 267 xh=80; 268 tft.fillRect(82,72,43,35,ST7735_BLACK); 269 270 } 271} 272void vmax() { 273// calcul vitese maximum 274 speed1 = (gps.speed.kmph()); 275 if ( speed1 > maxspeed) { 276 maxspeed = speed1; 277 } 278 } 279 void hmax() { 280// calcul altitude maximum 281 high1 = (gps.altitude.meters()); 282 if ( high1 > maxhigh) { 283 maxhigh = high1; 284 } 285 } 286
gps data logger
arduino
1#include <SPI.h> 2#include <Adafruit_GFX.h> 3#include <Adafruit_ST7735.h> 4#define cs 10 5#define dc 9 6#define rst 8 7#include <TinyGPS++.h> 8#include <SoftwareSerial.h> 9Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst); 10static const int RXPin = 4, TXPin = 3; //GPS communication 11static const uint32_t GPSBaud = 9600; 12 13#define OLED_RESET 5 14 15 16 17TinyGPSPlus gps; 18SoftwareSerial ss(RXPin, TXPin); 19 20int x=80; 21int xh=80; 22int maxhigh=0; 23int maxspeed = 0, speed1 = 0; 24int high1 = 0;; 25 26 27void setup() 28{ 29 30 Serial.begin(9600); 31 ss.begin(GPSBaud); 32 33 tft.initR(INITR_GREENTAB); 34 tft.fillScreen(ST7735_BLACK); 35 tft.setCursor(5, 58); 36 tft.setTextSize(1); 37 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 38 tft.print("initilisation"); 39 40 41 42 43} 44 45void loop() 46{ 47 48 tft.setTextSize(1); 49 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 50 51 // affichage des informations a chaque bonne reception satellite 52 while (ss.available() > 0){ 53 gps.encode(ss.read()); 54 if (gps.location.isUpdated()){ 55 56 cadre(); 57 58 59 60 61 62 tft.setCursor(5, 44); 63 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 64 tft.print("Latitude :"); 65 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 66 tft.print(gps.location.lat(), 6); 67 tft.setCursor(5, 58); 68 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 69 tft.print("Longitude :"); 70 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 71 tft.print(gps.location.lng(), 6); 72 73 74 75 76 77 78 79 //affichage ecran date 80 tft.setCursor(5, 7); 81 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 82 tft.print("date : "); 83 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 84 tft.print(gps.date.day()); 85 tft.print(" "); 86 tft.print(gps.date.month()); 87 tft.print(" "); 88 tft.print(gps.date.year()); 89 90 91 92 93 //affichage ecran heure 94 tft.setCursor(5, 20); 95 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 96 tft.print("heure : "); 97 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 98 tft.print(gps.time.hour()+1); 99 tft.print(" "); 100 tft.print(gps.time.minute()); 101 tft.print(" "); 102 tft.print(gps.time.second()); 103 tft.print(" "); 104 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 105 tft.setCursor(3, 30); 106 107 108 109 110 111 //affichage ecran altitude 112 tft.setCursor(5, 80); 113 tft.print("H m :"); 114 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 115 tft.print (gps.altitude.meters(),0); 116 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 117 tft.print(" "); 118 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 119 tft.setCursor(5, 95); 120 hmax(); 121 tft.print("Hmax :"); 122 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 123 tft.print(maxhigh); 124 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 125 tft.print(" "); 126 courbeh(); 127 128 129 //affichage ecran vitesse 130 tft.setCursor(5, 115); 131 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 132 tft.print("V act: "); 133 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 134 tft.print (gps.speed.kmph(),0); 135 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 136 tft.print(" "); 137 tft.setCursor(5, 130); 138 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 139 vmax(); 140 tft.print("vmax: "); 141 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 142 tft.print(maxspeed); 143 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 144 tft.print(" "); 145 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 146 courbe(); 147 148 149 150 151 //affichage ecran nombre de satellites 152 tft.setCursor(5, 147); 153 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 154 tft.print("nombre de Sat : "); 155 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 156 tft.print(gps.satellites.value()); 157 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 158 tft.print(" "); 159 160 // Horizontal Dim. of Precision (100ths-i32) 161 Serial.print("HDOP = "); 162 Serial.println(gps.hdop.value()); 163 164 165 166 167 168 169 170 smartDelay(400); 171 172 173 174} 175 } 176} 177// delai pour une bonne recption 178static void smartDelay(unsigned long ms) 179{ 180 unsigned long start = millis(); 181 do 182 { 183 while (ss.available()) 184 gps.encode(ss.read()); 185 } while (millis() - start < ms); 186} 187void cadre() { 188 // affichage ecran 189 //cadre 190 tft.drawLine(0,0,130,0,ST7735_RED); 191 tft.drawLine(0,1,130,1,ST7735_RED); 192 tft.drawLine(0,158,130,158,ST7735_RED); 193 tft.drawLine(0,142,130,142,ST7735_RED); 194 tft.drawLine(0,141,130,141,ST7735_RED); 195 tft.drawLine(0,107,130,107,ST7735_RED); 196 tft.drawLine(0,108,130,108,ST7735_RED); 197 198 tft.drawLine(80,108,80,140,ST7735_RED); 199 tft.drawLine(81,109,81,140,ST7735_RED); 200 201 tft.drawLine(80,70,80,108,ST7735_RED); 202 tft.drawLine(81,70,81,108,ST7735_RED); 203 204 tft.drawLine(0,159,130,159,ST7735_RED); 205 tft.drawLine(0,0,0,156,ST7735_RED); 206 tft.drawLine(1,1,1,157,ST7735_RED); 207 tft.drawLine(127,0,127,156,ST7735_RED); 208 tft.drawLine(126,0,126,156,ST7735_RED); 209 tft.drawLine(0,35,130,35,ST7735_RED); 210 tft.drawLine(0,36,130,36,ST7735_RED); 211 tft.drawLine(0,70,130,70,ST7735_RED); 212 tft.drawLine(0,71,130,71,ST7735_RED); 213 214} 215 216void courbe() { 217 218 219 int nouvelleValeur; 220 221 // converison vitesse max (350 km/h) en pixel 222 nouvelleValeur = map((gps.speed.kmph()), 0, 150, 137, 110); // car l'cran a 64 pixels de haut 223 224 225 x++; 226 227 tft.drawPixel(x,nouvelleValeur,ST7735_CYAN); 228 if (x>123) { 229 x=80; 230 tft.fillRect(82,110,43,30,ST7735_BLACK); 231 232 } 233} 234void courbeh() { 235 236 237 int nouvelleValeurh; 238 239 // converison vitesse max (350 km/h) en pixel 240 nouvelleValeurh = map((gps.altitude.meters()), 0, 1000, 104, 72); // car l'cran a 64 pixels de haut 241 242 243 xh++; 244 245 tft.drawPixel(xh,nouvelleValeurh,ST7735_CYAN); 246 if (xh>123) { 247 xh=80; 248 tft.fillRect(82,72,43,35,ST7735_BLACK); 249 250 } 251} 252void vmax() { 253// calcul vitese maximum 254 speed1 = (gps.speed.kmph()); 255 if ( speed1 > maxspeed) { 256 maxspeed = speed1; 257 } 258 } 259 void hmax() { 260// calcul altitude maximum 261 high1 = (gps.altitude.meters()); 262 if ( high1 > maxhigh) { 263 maxhigh = high1; 264 } 265 } 266
sauvegarde SD
arduino
data logger
1#include <SPI.h> 2#include<SD.h> 3#include <Adafruit_GFX.h> 4#include <Adafruit_ST7735.h> 5#define cs 10 6#define dc 9 7#define rst 8 8#include <TinyGPS++.h> 9#include <SoftwareSerial.h> 10Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst); 11static const int RXPin = 4, TXPin = 3; //GPS communication 12static const uint32_t GPSBaud = 9600; 13const int cs_sd=4; 14#define OLED_RESET 5 15 16 17 18TinyGPSPlus gps; 19SoftwareSerial ss(RXPin, TXPin); 20 21int x=80; 22int xh=80; 23int maxhigh=0; 24int maxspeed = 0, speed1 = 0; 25int high1 = 0;; 26 27 28void setup() 29{ 30 31 Serial.begin(9600); 32 ss.begin(GPSBaud); 33 tft.initR(INITR_GREENTAB); 34 tft.fillScreen(ST7735_BLACK); 35 tft.setCursor(5, 58); 36 tft.setTextSize(1); 37 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 38 tft.print("initilisation"); 39 tft.setCursor(5, 70); 40 tft.print("init SD"); 41 delay(1000); 42 if(!SD.begin(cs_sd)) //Condition vrifiant si la carte SD est prsente dans l'appareil 43 { 44 tft.setCursor(5, 82); 45 tft.print("Defaut SD"); 46 return; 47 } 48 tft.setCursor(5, 82); 49 tft.print("Carte SD OK"); 50 51 delay(1000); 52 tft.fillScreen(ST7735_BLACK); 53 54 File data = SD.open("donnees.txt",FILE_WRITE); // Ouvre le fichier "donnees.txt" 55 data.println(""); data.println("Dmarrage acquisition"); // Ecrit dans ce fichier 56 data.close(); 57 58 59 60} 61 62void loop() 63{ 64 65 tft.setTextSize(1); 66 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 67 68 // affichage des informations a chaque bonne reception satellite 69 while (ss.available() > 0){ 70 gps.encode(ss.read()); 71 if (gps.location.isUpdated()){ 72 73 cadre(); 74 75 76 77 78 79 tft.setCursor(5, 44); 80 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 81 tft.print("Latitude :"); 82 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 83 tft.print(gps.location.lat(), 6); 84 tft.setCursor(5, 58); 85 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 86 tft.print("Longitude :"); 87 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 88 tft.print(gps.location.lng(), 6); 89 90 91 92 93 94 95 96 //affichage ecran date 97 tft.setCursor(5, 7); 98 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 99 tft.print("date : "); 100 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 101 tft.print(gps.date.day()); 102 tft.print(" "); 103 tft.print(gps.date.month()); 104 tft.print(" "); 105 tft.print(gps.date.year()); 106 107 String Date=String(gps.date.day())+(" ")+(gps.date.month())+(" ")+(gps.date.year()); 108 109 110 //affichage ecran heure 111 tft.setCursor(5, 20); 112 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 113 tft.print("heure : "); 114 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 115 tft.print(gps.time.hour()+1); 116 tft.print(" "); 117 tft.print(gps.time.minute()); 118 tft.print(" "); 119 tft.print(gps.time.second()); 120 tft.print(" "); 121 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 122 tft.setCursor(3, 30); 123 124 String Temps=String(gps.time.hour()+1)+(" ")+(gps.time.minute())+(" ")+(gps.time.second()); 125 126 127 128 //affichage ecran altitude 129 tft.setCursor(5, 80); 130 tft.print("H m :"); 131 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 132 tft.print (gps.altitude.meters(),0); 133 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 134 tft.print(" "); 135 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 136 tft.setCursor(5, 95); 137 hmax(); 138 tft.print("Hmax :"); 139 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 140 tft.print(maxhigh); 141 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 142 tft.print(" "); 143 courbeh(); 144 145 146 //affichage ecran vitesse 147 tft.setCursor(5, 115); 148 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 149 tft.print("V act: "); 150 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 151 tft.print (gps.speed.kmph(),0); 152 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 153 tft.print(" "); 154 tft.setCursor(5, 130); 155 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 156 vmax(); 157 tft.print("vmax: "); 158 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 159 tft.print(maxspeed); 160 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 161 tft.print(" "); 162 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 163 courbe(); 164 165 166 167 168 //affichage ecran nombre de satellites 169 tft.setCursor(5, 147); 170 tft.setTextColor(ST7735_GREEN,ST7735_BLACK); 171 tft.print("nombre de Sat : "); 172 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 173 tft.print(gps.satellites.value()); 174 tft.setTextColor(ST7735_CYAN,ST7735_BLACK); 175 tft.print(" "); 176 177 // Horizontal Dim. of Precision (100ths-i32) 178 Serial.print("HDOP = "); 179 Serial.println(gps.hdop.value()); 180 181 182 183 184 185 186 187 smartDelay(400); 188 189 // Ecriture des donnes dans le fichier texte 190 File data=SD.open("donnees.txt",FILE_WRITE); 191 data.println(Date + " " + Temps + " " + String(gps.location.lat(), 6)+" "+String(gps.location.lng(), 6)+(" ")+String(gps.altitude.meters(),0)+(" ")+String(maxhigh)+(" ")+String(gps.speed.kmph(),0)+(" ")+String(maxspeed)); 192 data.close(); 193 194} 195 } 196} 197// delai pour une bonne recption 198static void smartDelay(unsigned long ms) 199{ 200 unsigned long start = millis(); 201 do 202 { 203 while (ss.available()) 204 gps.encode(ss.read()); 205 } while (millis() - start < ms); 206} 207void cadre() { 208 // affichage ecran 209 //cadre 210 tft.drawLine(0,0,130,0,ST7735_RED); 211 tft.drawLine(0,1,130,1,ST7735_RED); 212 tft.drawLine(0,158,130,158,ST7735_RED); 213 tft.drawLine(0,142,130,142,ST7735_RED); 214 tft.drawLine(0,141,130,141,ST7735_RED); 215 tft.drawLine(0,107,130,107,ST7735_RED); 216 tft.drawLine(0,108,130,108,ST7735_RED); 217 218 tft.drawLine(80,108,80,140,ST7735_RED); 219 tft.drawLine(81,109,81,140,ST7735_RED); 220 221 tft.drawLine(80,70,80,108,ST7735_RED); 222 tft.drawLine(81,70,81,108,ST7735_RED); 223 224 tft.drawLine(0,159,130,159,ST7735_RED); 225 tft.drawLine(0,0,0,156,ST7735_RED); 226 tft.drawLine(1,1,1,157,ST7735_RED); 227 tft.drawLine(127,0,127,156,ST7735_RED); 228 tft.drawLine(126,0,126,156,ST7735_RED); 229 tft.drawLine(0,35,130,35,ST7735_RED); 230 tft.drawLine(0,36,130,36,ST7735_RED); 231 tft.drawLine(0,70,130,70,ST7735_RED); 232 tft.drawLine(0,71,130,71,ST7735_RED); 233 234} 235 236void courbe() { 237 238 239 int nouvelleValeur; 240 241 // converison vitesse max (350 km/h) en pixel 242 nouvelleValeur = map((gps.speed.kmph()), 0, 150, 137, 110); // car l'cran a 64 pixels de haut 243 244 245 x++; 246 247 tft.drawPixel(x,nouvelleValeur,ST7735_CYAN); 248 if (x>123) { 249 x=80; 250 tft.fillRect(82,110,43,30,ST7735_BLACK); 251 252 } 253} 254void courbeh() { 255 256 257 int nouvelleValeurh; 258 259 // converison vitesse max (350 km/h) en pixel 260 nouvelleValeurh = map((gps.altitude.meters()), 0, 1000, 104, 72); // car l'cran a 64 pixels de haut 261 262 263 xh++; 264 265 tft.drawPixel(xh,nouvelleValeurh,ST7735_CYAN); 266 if (xh>123) { 267 xh=80; 268 tft.fillRect(82,72,43,35,ST7735_BLACK); 269 270 } 271} 272void vmax() { 273// calcul vitese maximum 274 speed1 = (gps.speed.kmph()); 275 if ( speed1 > maxspeed) { 276 maxspeed = speed1; 277 } 278 } 279 void hmax() { 280// calcul altitude maximum 281 high1 = (gps.altitude.meters()); 282 if ( high1 > maxhigh) { 283 maxhigh = high1; 284 } 285 } 286
Downloadable files
wiring prototype
wiring prototype
wiring prototype
wiring prototype
Comments
Only logged in users can leave comments