bonjours
je suis débutant dans l'Arduino,je me suis lancé sur un petit projet gps ( qui est visiblement sur le net un grand classique) pour me reméttre à jour dans l'éléctronique car mon bac sti est un peut loin est visiblement ça a un peut beaucoup évolué, et je me suis aussi lancé sur ce projet de mini gps car il répond à un autre besoin. je fait de la course à pieds et j'ai besoin d'un produit trés petit.
j'ai fait pas mal de recherche sur le net pour trouver un code de base fonctionnel est le faire évoluer.
j'ai pas trouvé beaucoup de code fonctionelle j'ai trouvé notament un récament qui correspond à peut prés à mon besoin je les fait évolué pour ce rapprocher de mon besoin le programme fonctionne très bien mais il me manque 2 éléments:
- je n'arrive pas trouver comment faire pour Integer la donner vitesse à mon projet
- je souhaiterais aussi que la commande de bascule entre les infos altitude vitesse et coordonnées latitude longitude ce face par un bouton poussoir ( actuellement ça ce fait actuellement à intervalle régulier et automatiquement).
j'ai trouvé les code de librairie mais je ne comprend pas trop comment les intégrer
le montage est composé de:
un module gps néo 6mv2
d'un afficheur oled kuman 0,96
d'un arduino un de chez elegoo
voila le code du projet
/
#include <SPI.h> //Serial Peripheral Interface (SPI) library for synchronous serial data protocol
#include <Wire.h> //Wire library used for I2C communication: Arduino Pro Mini pins used = A4 (SDA) and A5 (SCL)
#include <Adafruit_GFX.h> //Adafruit graphic display library used for the OLED display
#include <Adafruit_SSD1306.h> //Adafruit driver for OLED
#include <SoftwareSerial.h> //SoftwareSerial library used to allow serial communication on other digital pins (i.e. Pins 3 & 4 for the this GPS project)
#include <TinyGPS.h> //GPS Library used to read the data from GPS Module
#define OLED_RESET 5
#define _GPS_KM_PER_METER 0.001
Adafruit_SSD1306 display(OLED_RESET);
TinyGPS gps; //Create the TinyGPS object, giving it a name of your choice (here we use the name gps)
SoftwareSerial nss(3, 4); //set sotfware serial communications to arduino ports 3 and 4 (TX = 3 and RX = 4)
const int buttonPin = 5;
unsigned int buttonState = 0;
void setup()
{
nss.begin(9600);
unsigned long age, date, time, chars = 0;
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize the OLED and set the I2C address to 0x3C (for the 128x64 OLED)
display.clearDisplay(); //Clear display buffer.
display.setTextSize(2); //set text size to 2 (large)
display.setTextColor(WHITE);
display.setCursor(0,0); //set text start position to column=0 and row=0
display.print(" Benito"); //
display.setTextSize(1); //set text size to 1 (small)
display.setCursor(30,18); //set text start position to column=0 and row=18
display.print("GPS SYSTEM"); //print "GPS SYSTEM" to display
display.display(); //update OLED with new display data
delay(2000); //short delay
display.clearDisplay(); //clear display
}
//MAIN PROGRAMME LOOP
void loop() {
bool newdata = false;
unsigned long start = millis();
while(millis() - start < 1000){ // Every 1 seconds we print an update
if (feedgps())
newdata = true;
}
if (newdata)
{
gpsdump(gps);
}
}
//PRINT GPS DATA TO OLED DISPLAY
void gpsdump(TinyGPS &gps)
{
float flat, flon, falt;
display.clearDisplay();
display.setTextSize(1); //set text size to 1
display.setTextColor(WHITE); //
gps.f_get_position(&flat, &flon); //retrieves latitude and longditude data
display.setCursor(0,0); //set text start position to column=0 and row=20
display.print("Altitude : "); //print "Altitude" : to display
display.println(gps.f_altitude());//print altitude data to display
display.setCursor(100,0); //set text start position to column=100 and row=20
display.println(" M "); //print "m" to display
display.setCursor(0,10); //set text start position to column=0 and row=40
display.print("vitesse : "); //print "vitesse :" to display
display.setCursor(100,10); //set text start position to column=100 and row=20
display.println("KM/H"); //print "KM/H" to display
display.display(); //update OLED with new display data
delay(10000); //short delay
display.clearDisplay(); //clear display
display.setCursor(0,10); //set text start position to column=0 and row=40
display.print("latitude : "); //print "latitude :" to display
display.println(flat,6); //print latitude data to display up to 6 decimal places
display.setCursor(0,20); //set text start position to column=0 and row=50
display.print("longitude: "); //print "longitude:" to display
display.println(flon,6); //print longitude data to display up to 6 decimal places
display.display();
delay(10000); //short delay
}
//TEST FOR NEW DATA FROM THE GPS MODULE
bool feedgps()
{
while (nss.available())
{
if (gps.encode(nss.read())) //Each byte of NEMA data must be giving to TinyGPS by using encode(). True is returned when new data has been fully decoded and can be used
return true;
}
return false;
}
merci part avance des conseils est aides pour ce projet