− | In this sketch, we call '''GPS.read()''' within a once-a-millisecond timer (this is the same timer that runs the '''millis()''' command). Then in the main loop we can ask if a new chunk of data has been received by calling '''GPS.newNMEAreceived()''', if this returns '''true''' then we can ask the library to parse that data with '''GPS.parse(GPS.lastNMEA())'''.
| + | Dans ce sketch nous appelons '''GPS.read()''' dans le timer once-a-millisecond (c'est le timer qui exécute la commande '''millis()'''). Ensuite, nous pouvons utiliser la fonctio '''GPS.newNMEAreceived()''' afin de vérifier si un nouveau paquet d'information est disponible. Si la fonction GPS.newNMEAreceived() retourne '''true''' (vrai) alors nous pouvons demander à la librairie d'analyser le paquet de donnée à l'aide de '''GPS.parse(GPS.lastNMEA())'''. |
− | We do have to keep querying and parsing in the main loop - its not possible to do this in an interrupt because then we'd be dropping GPS data by accident.
| + | Il est nécessaire de maintenir les processus d'interrogation et d'analyse dans la boucle principale (loop) du programme. En effet, si ces opérations étaient prisent en charge par une intérruption, nous perdrions (effacerions) des données GPS par accident. |
− | Once data is parsed, we can just ask for data from the library like '''GPS.day''', '''GPS.month''' and '''GPS.year''' for the current date. '''GPS.fix''' will be 1 if there is a fix, 0 if there is none. If we have a fix then we can ask for '''GPS.latitude''', GPS.longitude, '''GPS.speed''' (in knots, not mph or k/hr!), '''GPS.angle''', '''GPS.altitude''' (in centimeters) and '''GPS.satellites''' (number of satellites)
| + | Une fois que les données sont analysées (parsed), nous pouvons obtenir les informations depuis la librairie en appelant des fonctions telles que '''GPS.day''' (''le jour''), '''GPS.month''' (''le mois'') et '''GPS.year''' (''l'année'') fournissant les détails de la date courante. '''GPS.fix''' sera à 1 s'il y a une synchronisation (fix), 0 s'il n'y a pas de synchronisation. Si nous avons une synchronisation, nous pouvons obtenir la latitude via '''GPS.latitude''', la longitude via '''GPS.longitude''', la vitesse via '''GPS.speed''' (en knots, pas en mph ou km/h!), l'angle via '''GPS.angle''', l'altitude via '''GPS.altitude''' (en centimetres) et le nombres de satellites avec '''GPS.satellites'''. |