Skip to content

Instantly share code, notes, and snippets.

@slzatz
slzatz / transfer.py
Created May 19, 2022 12:44
transfer files to mcu
from time import sleep
import serial
import sys
from os.path import exists
def print_lines(lines):
for line in lines:
print(line.decode("utf-8", "ignore"))
def write(cmd):
'''
Based on Paul Sokolovsky's work on micropython mqtt client
Note MicroPython socket module supports file interface directly (read)
'''
import socket
import ustruct as struct
import time
class MQTTClient:
@slzatz
slzatz / umqtt.py
Created April 16, 2016 19:57
This is an mqtt subscribe client for micropython
# Copyright (c) 2012-2014 Roger Light <roger@atchoo.org>
#
# This is a stripped down version of paho.mqtt intended for micropython
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v1.0 which accompany this distribution.
#
# The Eclipse Public License is available at
# http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
@slzatz
slzatz / font.py
Last active January 28, 2020 12:39
I2C driver for micropython esp8266 ssd1306 OLED (ssd1306a.py is paired down and works with the font.py file to allowing generating text)
# Originally from https://github.com/guyc/py-gaugette/blob/master/gaugette/font5x8.py
# Contains ASCII 32 (space) through ASCII 90 (Z)
cols = 5
rows = 8
bytes = [
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x5F, 0x00, 0x00,
0x00, 0x07, 0x00, 0x07, 0x00,
0x14, 0x7F, 0x14, 0x7F, 0x14,