What is Machine Learning? (cont.)

import serial,sys,string import boto3 commport = ‘/dev/ttyO1’ commbaud = 9600 s = serial.Serial(commport,commbaud) # ‘$GPGGA,030808.131,8960.000000,N,00000.000000,E,0,0,,137.000,M,13.000,M,,*43rn’ regionname = ‘us-east-1’ client = boto3.client(‘firehose’,region_name=regionname) while(1): line = s.readline() #sys.stdout.write(line) words = string.split(line,’,’) #words = line.strip().split(‘,’) if(words[0] == ‘$GPGGA’): time = words[1] lat = words[2] lath = words[3] lon = words[4] lonh = words[5] fixqal = words[6] sats = words[7] hdil = words[8] alt = words[9] gps = ‘1’ # The GPS receiver being interrogated print ‘>>>>>>>>>>>>>>>>>>>>>>>>>>>>>’ sys.stdout.write(line) print ‘>>>>>>>>>>>>>>>>>>>>>>>>>>>>>’ print print ‘Time : ‘,time print ‘Latitude : ‘,lat,lath print ‘Longitude : ‘,lon,lonh print ‘Altitude : ‘,alt print ‘Fix quality : ‘,fixqal print ‘Satellites : ‘,sats print ‘Horiz Dilution: ‘,hdil print ‘==============================’ seq = (gps,time,lat,lath,lon,lonh,alt,fixqal,sats,hdil) sep = ‘:’ sentence = sep.join(seq) + ‘n’ sys.stdout.write(sentence) print ‘==============================’ response = client.put_record( DeliveryStreamName=’jameso-firehose-redshift’, Record={ ‘Data’: sentence }…


Link to Full Article: What is Machine Learning? (cont.)

Pin It on Pinterest

Share This