Skip to content

Instantly share code, notes, and snippets.

@inmcm
inmcm / settings.json
Created August 25, 2016 04:30
VS Code User Settings
{
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.rulers": [100],
"editor.renderIndentGuides": true,
"window.openFilesInNewWindow": false
}
@inmcm
inmcm / conversions.py
Created August 8, 2016 03:55
Byte <-> Strings <-> Ints Conversion Examples
from binascii import hexlify,unhexlify
from struct import unpack, pack
from array import array
# Byte Constants
some_bytes = b'\x12\x34\x56\x78\x9A\xBC\xDE\xF0'
some_string_bytes = b'Hello!'
some_ascii_hex_bytes = b'\x33\x46\x44\x65\x32\x33\x43\x41\x31'
some_other_bytes = b'\x99\xEF\x31\xC4\x25\xD8\x46\x3A'
some_little_packed_bytes = b'\x00\x00\x16\x3e'
@inmcm
inmcm / gist:1a0e8b80f2d8faff832b
Created March 1, 2015 21:52
Setup Adafruit GPS to Max Data Output and Parse Test
from pyb import UART
from micropyGPS import MicropyGPS
import mtk
# Instatntiate the micropyGPS object
my_gps = MicropyGPS()
print('Setting Up UART to 9600bps')
baud = 9600
uart = UART(3, baud)
@inmcm
inmcm / gist:179e31c3890349c4aad9
Created December 18, 2014 00:28
#Get Average Time in micros for the final Sentence Parsing
#Get Average Time in micros for the final Sentence Parsing
from micropyGPS import MicropyGPS
sentence1 = '$GPRMC,181714.898,A,3748.8617,N,08338.9530,W,000.0,237.0,240911,,,A*79'
sentence2 = '$GPGGA,181715.898,3748.8604,N,08338.9539,W,1,09,0.9,371.4,M,-32.5,M,,0000*60'
sentence3 = '$GPGSA,A,3,07,11,28,24,26,08,04,17,20,,,,1.7,0.9,1.4*3F'
sentence4 = '$GPGSV,3,1,12,28,76,017,38,17,56,282,38,01,46,055,40,08,38,183,47*75'
my_gps = MicropyGPS()
@inmcm
inmcm / gist:bf22a292a7609314937f
Last active August 29, 2015 14:11
#Get parse time in microseconds on pyboard
#Get parse time in microseconds on pyboard
from micropyGPS import MicropyGPS
sentence1 = '$GPRMC,181714.898,A,3748.8617,N,08338.9530,W,000.0,237.0,240911,,,A*79'
sentence2 = '$GPGGA,181715.898,3748.8604,N,08338.9539,W,1,09,0.9,371.4,M,-32.5,M,,0000*60'
sentence3 = '$GPGSA,A,3,07,11,28,24,26,08,04,17,20,,,,1.7,0.9,1.4*3F'
sentence4 = '$GPGSV,3,1,12,28,76,017,38,17,56,282,38,01,46,055,40,08,38,183,47*75'
my_gps = MicropyGPS()