Esempio n. 1
0
                            delimiter=',',
                            quotechar='|',
                            quoting=csv.QUOTE_MINIMAL)
    datawriter.writerow([
        'temperature', 'sound', 'pressure', 'latitude', 'longitude', 'altitude'
    ])

while True:
    try:
        lcdDisplay.setText("Gathering Data")
        curTemp = gpi.temp(TEMP_SENSOR)  # Get temperature in celcius
        # Get current sound level in ???
        curSound = gpi.analogRead(SOUND_SENSOR)
        curPressure = bmpSensor.readPressure(
        ) / 100  # Get current presure in millibar
        curCoords = gpsSensor.read(
        )  # Get the current data from the GPS module

        print str(curTemp) + ', ' + str(curSound) + ', ' + \
            str(curPressure)  # Print Current Readings from Sensors
        print str(curCoords.latitude) + ', ' + str(curCoords.longitude) + \
            ', ' + str(curCoords.altitude)  # Print Current Readings from GPS
        lcdDisplay.setText("Saved Data")

        message = [curCoords.latitude, curCoords.longitude, curCoords.altitude]

        if secondElapsed % 30 == 0:
            # Send Data to Modem
            satModem.sendMessage(str(message))
            lcdDisplay.setText("Sent Data")

        with open('flight.csv', 'a') as csvfile:
Esempio n. 2
0
 def readgps(self, ser):
     data = GPS(ser)
     data.read()
     self.gpsdata = data.sqlquery()
Esempio n. 3
0
from gps import GPS
from time import sleep
from bsmLib import tcpClient
from time import sleep
#r = '$GPRMC,154633.000,A,4457.4413,N,09320.5487,W,0.19,0.07,011118,,,A*7B'

tcpClient(host = '192.168.21.153', port = '10002')
t = tcpClient()
t.connect()

while True:
    sleep (2)

    g = GPS()
    r = g.read()

    start = r.find('$GPRMC')
    end = r.find(',0.', start)
    log = r[start:end]

    start2 = log.find('A')
    end2 = log.find('W', start2)
    log2 = log[start2:end2]

    start3 = log2.find('44')
    end3 = log2.find(',N', start3)
    lat = log2[start3:end3]

    start4 = log2.find('09')
    end4 = log2.find(',W,', start4)
    lon = log2[start4:end4]