Skip to content

Instantly share code, notes, and snippets.

import matplotlib.pyplot
import datetime
x = []
height = []
humidity = []
readFile = open("C:\Users\Keith\Documents\data.txt", "r")
max_altitude = 0
#define clockPin 13
#define MISO 12
#define MOSI 11
#define SS 7
void setup()
{
pinMode(clockPin, OUTPUT);
pinMode(MISO, INPUT);
pinMode(MOSI, OUTPUT);
[18:25] <ibanezmatt13_> internet failed
[18:26] <eroomde> np
[18:26] <ibanezmatt13_> so yeah, I've tried a few methods and keep getting lost somewhere
[18:26] <ibanezmatt13_> I tried to replace multiple resistors with 1 resistor to narrow it down
[18:27] <eroomde> it's ok, you're doing what everyone does
[18:27] <eroomde> draws a net
[18:27] <ibanezmatt13_> yes
[18:27] <eroomde> but then reaslises that won't work because two end edges of the net are actually electrically connected
[18:27] <eroomde> and wonders how you're meant to deal with things folding back on themselves
[18:28] <eroomde> nd so on
char NMEA_string[70] = "";
char buffer = 0;
int n = 0;
int state = 0;
while (1){
buffer = Serial.read(); // Read Character
switch(state){
case 0: // Waiting for a $
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// function to convert latitude into decimal degrees
int check_latitude(char* latitude, char* ind, float* new_latitude)
{
[15:59] <ibanezmatt13_> internet failed
[16:00] <mfa298> the bits I said are:
[16:00] <mfa298> the TODO note is there as I know it's making assumptions
[16:00] <mfa298> the way it's written it will only work if the first two digits are degrees and the rest is minutes
[16:00] <ibanezmatt13_> oh
[16:01] <ibanezmatt13_> does the ublox always return the lat in the same format?
[16:02] <mfa298> that's the assumption I'm making
[16:02] <mfa298> although it's something I'll probably fix sometime
[16:03] <ibanezmatt13_> I think I personally would like to make a pretty bomb-proof function
[16:03] <ibanezmatt13_> problem is that all the examples I have seen a far too complex for me to understand
[19:59] <eroomde> come across atoi() yes?
[19:59] <ibanezmatt13> n
[19:59] <eroomde> yet*
[19:59] <ibanezmatt13> no
[20:00] <eroomde> google it
[20:00] <ibanezmatt13> ok
[20:01] <ibanezmatt13> So atoi() essentially just converts the string of an integer into an integer
[20:02] <ibanezmatt13> latitude = atoi(latitude); ?
[20:03] <ibanezmatt13> question is, is that really going to help with latitude as I don't want to convert that into an integer
[20:05] <ibanezmatt13> see you :)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char* NMEA_string = "$GPGGA,212748.000,5056.6505,N,00124.3531,W,2,07,1.8,102.1,M,47.6,M,0.8,0000*6B"; // example first part of NMEA sentence
int counter = 0; // sentence id
// function to convert latitude into decimal degrees
#include <stdio.h>
char mystring[] = "$GPGGA,124321,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47"; //example first part of NMEA sentence
void main()
{
char time[7];
char identifier[20];
char latitude[10];
char north_south[2];
byte gps_set_sucess = 0 ;
void setup()
{
Serial.begin(9600); //initialise serial at 9600 baud
// THIS COMMAND SETS FLIGHT MODE AND CONFIRMS IT
uint8_t setNav[] = {
0xB5, 0x62, 0x06, 0x24, 0x24, 0x00, 0xFF, 0xFF, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00,