kopia lustrzana https://github.com/GuyCarver/MicroPython
Added esp32
rodzic
c81bab7396
commit
1d126ae0db
|
@ -0,0 +1,5 @@
|
|||
|
||||
import main
|
||||
|
||||
main.no_debug()
|
||||
main.connect()
|
|
@ -0,0 +1,60 @@
|
|||
import machine
|
||||
|
||||
#NOTE: For button, Pin 34 didn't work, but pin 32 did. Don't know what the difference is but not all pins work.
|
||||
|
||||
class joystick(object) :
|
||||
_x_center = 1789.0
|
||||
_y_center = 1817.0
|
||||
_pos_x = 4095.0 - _x_center
|
||||
_pos_y = 4095.0 - _y_center
|
||||
|
||||
def __init__( self, aX, aY, aButton ) :
|
||||
self._jx = machine.ADC(machine.Pin(aX))
|
||||
self._jy = machine.ADC(machine.Pin(aY))
|
||||
self._jx.width(machine.ADC.WIDTH_12BIT)
|
||||
self._jy.width(machine.ADC.WIDTH_12BIT)
|
||||
self._jx.atten(machine.ADC.ATTN_11DB)
|
||||
self._jy.atten(machine.ADC.ATTN_11DB)
|
||||
#Must be pull up. Pull down doesn't register change.
|
||||
self._js = machine.Pin(aButton, machine.Pin.IN, machine.Pin.PULL_UP)
|
||||
|
||||
self._x = 0.0
|
||||
self._y = 0.0
|
||||
self._button = False
|
||||
|
||||
self._index = 0
|
||||
self._xA = [0, 0, 0]
|
||||
self._yA = [0, 0, 0]
|
||||
|
||||
@property
|
||||
def x( self ) :
|
||||
'''Return value from -1.0 to 1.0.'''
|
||||
return self._x
|
||||
|
||||
@property
|
||||
def y( self ) :
|
||||
'''Return value from -1.0 to 1.0.'''
|
||||
return self._y
|
||||
|
||||
@property
|
||||
def button( self ) :
|
||||
'''return True or False.'''
|
||||
return self._button
|
||||
|
||||
def update( self ) :
|
||||
self._xA[self._index] = self._jx.read()
|
||||
self._yA[self._index] = self._jy.read()
|
||||
|
||||
self._index += 1
|
||||
if self._index >= 3 :
|
||||
self._index = 0
|
||||
|
||||
rx = float(sum(self._xA)) / 3.0 - joystick._x_center
|
||||
ry = float(sum(self._yA)) / 3.0 - joystick._y_center
|
||||
dx = joystick._pos_x if rx >= 0 else joystick._x_center
|
||||
dy = joystick._pos_y if ry >= 0 else joystick._y_center
|
||||
self._x = rx / dx
|
||||
self._y = ry / dy
|
||||
|
||||
#Value is 1 when not pressed and 0 when pressed.
|
||||
self._button = not self._js.value()
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
import esp
|
||||
import network
|
||||
|
||||
def connect():
|
||||
sta_if = network.WLAN(network.STA_IF)
|
||||
if not sta_if.isconnected() :
|
||||
print('Connecting to Carvers')
|
||||
sta_if.active(True)
|
||||
sta_if.connect('Carvers', 'gruntbuggly')
|
||||
while not sta_if.isconnected():
|
||||
pass
|
||||
ap_if = network.WLAN(network.AP_IF)
|
||||
ap_if.active(True)
|
||||
ap_if.config(essid="ESP32-1")
|
||||
print('network ip: ', sta_if.ifconfig()[0])
|
||||
print('{} access point: {}'.format(ap_if.config('essid'), ap_if.ifconfig()[0]))
|
||||
|
||||
def no_debug():
|
||||
# this can be run from the REPL as well
|
||||
esp.osdebug(None)
|
|
@ -0,0 +1,115 @@
|
|||
# MicroPython PCA9865 16 servo controller driver for ESP32.
|
||||
#NOTE: I tried writing 16 bit values for PWM but it crashed the controller requiring a power cycle to reset.
|
||||
|
||||
import machine
|
||||
from time import sleep_us
|
||||
|
||||
class pca9865(object):
|
||||
'''16 servo contoller. Use index 0-15 for the servo #.'''
|
||||
|
||||
_ADDRESS = 0x40
|
||||
_MODE1 = const(0)
|
||||
_PRESCALE = const(0xFE)
|
||||
|
||||
_LED0_ON_L = const(0x6) #We only use LED0 and offset 0-16 from it.
|
||||
# _LED0_ON_H = const(0x7)
|
||||
# _LED0_OFF_L = const(0x8)
|
||||
# _LED0_OFF_H = const(0x9)
|
||||
|
||||
# _ALLLED_ON_L = const(0xFA)
|
||||
# _ALLLED_ON_H = const(0xFB)
|
||||
# _ALLLED_OFF_L = const(0xFC)
|
||||
# _ALLLED_OFF_H = const(0xFD)
|
||||
|
||||
_DEFAULTFREQ = const(60)
|
||||
_MINPULSE = const(120)
|
||||
_MAXPULSE = const(600)
|
||||
|
||||
def __init__(self, aSDA, aSCL) :
|
||||
'''aSDA is I2C SDA pin #, aSCL is I2C SCL pin #.'''
|
||||
super(pca9865, self).__init__()
|
||||
self.i2c = machine.I2C(scl = machine.Pin(aSCL), sda = machine.Pin(aSDA))
|
||||
self._buffer = bytearray(4)
|
||||
self._b1 = bytearray(1)
|
||||
sleep_us(50)
|
||||
self.reset()
|
||||
self.minmax(_MINPULSE, _MAXPULSE)
|
||||
|
||||
def minmax( self, aMin, aMax ) :
|
||||
'''Set min/max and calculate range.'''
|
||||
self._min = aMin
|
||||
self._max = aMax
|
||||
self._range = aMax - aMin
|
||||
|
||||
def read( self, aLoc ) :
|
||||
'''Read 8 bit value and return.'''
|
||||
self.i2c.readfrom_mem_into(self._ADDRESS, aLoc, self._b1)
|
||||
return self._b1[0]
|
||||
|
||||
def writebuffer( self, aBuffer, aLoc ) :
|
||||
"""Write buffer to given address."""
|
||||
self.i2c.writeto_mem(self._ADDRESS, aLoc, aBuffer)
|
||||
|
||||
def write( self, aVal, aLoc ) :
|
||||
"""Write 8 bit integer aVal to given address aLoc."""
|
||||
self._b1[0] = aVal
|
||||
self.writebuffer(self._b1, aLoc)
|
||||
|
||||
def reset( self ):
|
||||
'''Reset the controller and set default frequency.'''
|
||||
self.write(0, _MODE1)
|
||||
self.setfreq(_DEFAULTFREQ)
|
||||
|
||||
def setfreq( self, aFreq ) :
|
||||
'''Set frequency for all servos. A good value is 60hz (default).'''
|
||||
aFreq *= 0.9 #Correct for overshoot in frequency setting.
|
||||
prescalefloat = (6103.51562 / aFreq) - 1 #25000000 / 4096 / freq.
|
||||
prescale = int(prescalefloat + 0.5)
|
||||
|
||||
oldmode = self.read(_MODE1)
|
||||
newmode = (oldmode & 0x7F) | 0x10
|
||||
self.write(newmode, _MODE1)
|
||||
self.write(prescale, _PRESCALE)
|
||||
self.write(oldmode, _MODE1)
|
||||
sleep_us(50)
|
||||
self.write(oldmode | 0xA1, _MODE1) #This sets the MODE1 register to turn on auto increment.
|
||||
|
||||
def setpwm( self, aServo, aOn, aOff ) :
|
||||
'''aServo = 0-15.
|
||||
aOn = 16 bit on value.
|
||||
aOff = 16 bit off value.
|
||||
'''
|
||||
if 0 <= aServo <= 15 :
|
||||
#Data = on-low, on-high, off-low and off-high. That's 4 bytes each servo.
|
||||
loc = _LED0_ON_L + (aServo * 4)
|
||||
# print(loc)
|
||||
self._buffer[0] = aOn
|
||||
self._buffer[1] = aOn >> 8
|
||||
self._buffer[2] = aOff
|
||||
self._buffer[3] = aOff >> 8
|
||||
self.writebuffer(self._buffer, loc)
|
||||
else:
|
||||
raise Exception('Servo index {} out of range.'.format(str(aServo)))
|
||||
|
||||
def off( self, aServo ) :
|
||||
'''Turn off a servo.'''
|
||||
self.setpwm(aServo, 0, 0)
|
||||
|
||||
def alloff( self ) :
|
||||
'''Turn all servos off.'''
|
||||
for x in range(0, 16):
|
||||
self.off(x)
|
||||
|
||||
def set( self, aServo, aPerc ) :
|
||||
'''Set the 0-100%. If < 0 turns servo off.'''
|
||||
if aPerc < 0 :
|
||||
self.off(aServo)
|
||||
else:
|
||||
val = self._min + ((self._range * aPerc) // 100)
|
||||
self.setpwm(aServo, 0, val)
|
||||
|
||||
def setangle( self, aServo, aAngle ) :
|
||||
'''Set angle -90 to +90. < -90 is off.'''
|
||||
#((a + 90.0) * 100.0) / 180.0
|
||||
perc = int((aAngle + 90.0) * 0.5556) #Convert angle +/- 90 to 0-100%
|
||||
self.set(aServo, perc)
|
|
@ -0,0 +1,163 @@
|
|||
#SentryBot control prototype.
|
||||
|
||||
#todo: Rotate head to max range
|
||||
# if head hits torso turn range, rotate torso
|
||||
# Do same for tilt.
|
||||
|
||||
#todo: May need to smooth out input. Simple way is to average n values (3?)
|
||||
|
||||
#todo: May need to ease in/out of movement in addition to time scaling.
|
||||
|
||||
import machine, time
|
||||
from pca9865 import pca9865
|
||||
import joystick
|
||||
|
||||
def moveto( aSource, aTarget, aRate ) :
|
||||
'''Move from aSource to aTarget by given rate.'''
|
||||
if aTarget < 0 :
|
||||
aSource = aTarget
|
||||
else:
|
||||
diff = (aTarget - aSource) * aRate
|
||||
aSource += diff
|
||||
if diff < 0 :
|
||||
aSource = max(aSource, aTarget)
|
||||
else:
|
||||
aSource = min(aSource, aTarget)
|
||||
|
||||
return aSource
|
||||
|
||||
def clamp( aValue, aRange ) :
|
||||
'''Clamp value between +/- aRange.'''
|
||||
s = -1.0 if aValue < 0.0 else 1.0
|
||||
aValue = min(abs(aValue), aRange)
|
||||
return aValue * s
|
||||
|
||||
def smooth( aValue ) :
|
||||
'''If value isn't above a certain threshold just return 0.0'''
|
||||
return aValue if abs(aValue) > 0.2 else 0.0
|
||||
|
||||
class bot(pca9865) :
|
||||
_HEAD_TURN_RANGE = 45.0
|
||||
_HEAD_TILT_RANGE = 20.0
|
||||
_HEAD_TILT_CENTER = -90.0 + _HEAD_TILT_RANGE
|
||||
_TORSO_TURN_START = 30.0
|
||||
_TORSO_TURN_RANGE = 85.0
|
||||
_TORSO_TILT_START = 10.0
|
||||
_TORSO_TILT_RANGE = 10.0
|
||||
_TORSO_TILT_CENTER = -90.0 + _TORSO_TILT_RANGE
|
||||
_WHEEL_TURN_START = 80.0
|
||||
|
||||
#Center value % for wheels.
|
||||
_LEFT_WHEEL_CENTER = -9.0 #45.0% = 81.0 deg or -9.0 if +/- 90.0
|
||||
_RIGHT_WHEEL_CENTER = -4.0 #48.0% = 86.4 deg or -4.0 if +/- 90.0
|
||||
|
||||
_SDA = const(25)
|
||||
_SCL = const(26)
|
||||
_JX = const(39)
|
||||
_JY = const(36)
|
||||
_JB = const(34)
|
||||
|
||||
#Servo indexes.
|
||||
_ttwist = const(0)
|
||||
_ttilt = const(1)
|
||||
_htwist = const(2)
|
||||
_htilt = const(3)
|
||||
_lwheel = const(4)
|
||||
_rwheel = const(5)
|
||||
|
||||
_updatefreq = const(16) #ms = 60hz.
|
||||
|
||||
#torso twist, tilt, head twist, tilt, l wheel, r wheel.
|
||||
_servopinA = [12, 13, 14, 15, 8, 9]
|
||||
#turn rate in degrees/second.
|
||||
_servorateA = [66.0, -33.0, 66.0, -33.0, 11.0, 11.0]
|
||||
_servocenterA = [0.0, _TORSO_TILT_CENTER, 0.0, _HEAD_TILT_CENTER, _LEFT_WHEEL_CENTER, _RIGHT_WHEEL_CENTER]
|
||||
|
||||
def __init__( self ) :
|
||||
super().__init__(_SDA, _SCL) #init pca9865
|
||||
self._joystick = joystick.joystick(_JX, _JY, _JB)
|
||||
#Values +/-90 deg. -100 = off.
|
||||
self._servoA = [0.0, -bot._TORSO_TILT_RANGE, 0.0, 0.0, 0.0, 0.0]
|
||||
self._time = time.ticks_ms()
|
||||
self.updateservos()
|
||||
|
||||
def updateservos( self ) :
|
||||
'''Iterate through all servo angles and write to servo.'''
|
||||
for i, s in enumerate(self._servoA) :
|
||||
a = bot._servocenterA[i] + s
|
||||
self.setangle(bot._servopinA[i], a)
|
||||
|
||||
def updatehead( self, aDT ) :
|
||||
'''Update movement from joystick. aDT is seconds passed since last update.'''
|
||||
x = self._joystick.x
|
||||
y = self._joystick.y
|
||||
|
||||
#Get turn/tilt rate for head.
|
||||
turn = x * bot._servorateA[_htwist] * aDT
|
||||
tilt = y * bot._servorateA[_htilt] * aDT
|
||||
|
||||
#Move turn/tilt by the desired rate from the joystick input.
|
||||
h = clamp(self._servoA[_htwist] + turn, bot._HEAD_TURN_RANGE)
|
||||
self._servoA[_htwist] = h
|
||||
self._servoA[_htilt] = clamp(self._servoA[_htilt] + tilt, bot._HEAD_TILT_RANGE)
|
||||
|
||||
#Now get the turn rate for torso.
|
||||
turn = x * bot._servorateA[_ttwist] * aDT
|
||||
|
||||
th = self._servoA[_ttwist]
|
||||
|
||||
#If head turn is > torso turn start angle and moving in the right direction then update torso turn.
|
||||
if abs(h) >= bot._TORSO_TURN_START and h * turn > 0 :
|
||||
th = clamp(th + turn, bot._TORSO_TURN_RANGE)
|
||||
self._servoA[_ttwist] = th
|
||||
|
||||
lw = -1000.0
|
||||
rw = -1000.0
|
||||
|
||||
if abs(th) >= bot._WHEEL_TURN_START and th * turn > 0 :
|
||||
lw = bot._servorateA[_lwheel]
|
||||
if th < 0 :
|
||||
lw = -lw
|
||||
|
||||
rw = lw
|
||||
|
||||
self._servoA[_lwheel] = lw
|
||||
self._servoA[_rwheel] = rw
|
||||
|
||||
def updatetime( self ) :
|
||||
'''Update the time, then return delta time in seconds.'''
|
||||
delay = 1
|
||||
|
||||
#Loop until we hit or exceed the target frame rate.
|
||||
while delay > 0 :
|
||||
ms = time.ticks_ms()
|
||||
dt = ms - self._time
|
||||
delay = _updatefreq - dt
|
||||
|
||||
#If we need to wait longer then do so.
|
||||
if delay > 0 :
|
||||
time.sleep_ms(delay)
|
||||
|
||||
self._time = ms
|
||||
return dt / 1000.0 #Convert ms to seconds.
|
||||
|
||||
def update( self ) :
|
||||
dt = self.updatetime()
|
||||
|
||||
#Read input and convert to rotations.
|
||||
self._joystick.update()
|
||||
|
||||
#todo: Move wheels based on what input?
|
||||
|
||||
#Apply rotations to head and torso.
|
||||
self.updatehead(dt)
|
||||
#Write values to the servos.
|
||||
self.updateservos()
|
||||
|
||||
def run( ) :
|
||||
b = bot()
|
||||
while True :
|
||||
b.update()
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,265 @@
|
|||
|
||||
#Font used for ST7735 display.
|
||||
|
||||
#Each character uses 5 bytes.
|
||||
#index using ASCII value * 5.
|
||||
#Each byte contains a column of pixels.
|
||||
#The character may be 8 pixels high and 5 wide.
|
||||
|
||||
sysfont = {"Width": 5, "Height": 8, "Start": 0, "End": 254, "Data": bytearray([
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x3E, 0x5B, 0x4F, 0x5B, 0x3E,
|
||||
0x3E, 0x6B, 0x4F, 0x6B, 0x3E,
|
||||
0x1C, 0x3E, 0x7C, 0x3E, 0x1C,
|
||||
0x18, 0x3C, 0x7E, 0x3C, 0x18,
|
||||
0x1C, 0x57, 0x7D, 0x57, 0x1C,
|
||||
0x1C, 0x5E, 0x7F, 0x5E, 0x1C,
|
||||
0x00, 0x18, 0x3C, 0x18, 0x00,
|
||||
0xFF, 0xE7, 0xC3, 0xE7, 0xFF,
|
||||
0x00, 0x18, 0x24, 0x18, 0x00,
|
||||
0xFF, 0xE7, 0xDB, 0xE7, 0xFF,
|
||||
0x30, 0x48, 0x3A, 0x06, 0x0E,
|
||||
0x26, 0x29, 0x79, 0x29, 0x26,
|
||||
0x40, 0x7F, 0x05, 0x05, 0x07,
|
||||
0x40, 0x7F, 0x05, 0x25, 0x3F,
|
||||
0x5A, 0x3C, 0xE7, 0x3C, 0x5A,
|
||||
0x7F, 0x3E, 0x1C, 0x1C, 0x08,
|
||||
0x08, 0x1C, 0x1C, 0x3E, 0x7F,
|
||||
0x14, 0x22, 0x7F, 0x22, 0x14,
|
||||
0x5F, 0x5F, 0x00, 0x5F, 0x5F,
|
||||
0x06, 0x09, 0x7F, 0x01, 0x7F,
|
||||
0x00, 0x66, 0x89, 0x95, 0x6A,
|
||||
0x60, 0x60, 0x60, 0x60, 0x60,
|
||||
0x94, 0xA2, 0xFF, 0xA2, 0x94,
|
||||
0x08, 0x04, 0x7E, 0x04, 0x08,
|
||||
0x10, 0x20, 0x7E, 0x20, 0x10,
|
||||
0x08, 0x08, 0x2A, 0x1C, 0x08,
|
||||
0x08, 0x1C, 0x2A, 0x08, 0x08,
|
||||
0x1E, 0x10, 0x10, 0x10, 0x10,
|
||||
0x0C, 0x1E, 0x0C, 0x1E, 0x0C,
|
||||
0x30, 0x38, 0x3E, 0x38, 0x30,
|
||||
0x06, 0x0E, 0x3E, 0x0E, 0x06,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x5F, 0x00, 0x00,
|
||||
0x00, 0x07, 0x00, 0x07, 0x00,
|
||||
0x14, 0x7F, 0x14, 0x7F, 0x14,
|
||||
0x24, 0x2A, 0x7F, 0x2A, 0x12,
|
||||
0x23, 0x13, 0x08, 0x64, 0x62,
|
||||
0x36, 0x49, 0x56, 0x20, 0x50,
|
||||
0x00, 0x08, 0x07, 0x03, 0x00,
|
||||
0x00, 0x1C, 0x22, 0x41, 0x00,
|
||||
0x00, 0x41, 0x22, 0x1C, 0x00,
|
||||
0x2A, 0x1C, 0x7F, 0x1C, 0x2A,
|
||||
0x08, 0x08, 0x3E, 0x08, 0x08,
|
||||
0x00, 0x80, 0x70, 0x30, 0x00,
|
||||
0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x00, 0x00, 0x60, 0x60, 0x00,
|
||||
0x20, 0x10, 0x08, 0x04, 0x02,
|
||||
0x3E, 0x51, 0x49, 0x45, 0x3E,
|
||||
0x00, 0x42, 0x7F, 0x40, 0x00,
|
||||
0x72, 0x49, 0x49, 0x49, 0x46,
|
||||
0x21, 0x41, 0x49, 0x4D, 0x33,
|
||||
0x18, 0x14, 0x12, 0x7F, 0x10,
|
||||
0x27, 0x45, 0x45, 0x45, 0x39,
|
||||
0x3C, 0x4A, 0x49, 0x49, 0x31,
|
||||
0x41, 0x21, 0x11, 0x09, 0x07,
|
||||
0x36, 0x49, 0x49, 0x49, 0x36,
|
||||
0x46, 0x49, 0x49, 0x29, 0x1E,
|
||||
0x00, 0x00, 0x14, 0x00, 0x00,
|
||||
0x00, 0x40, 0x34, 0x00, 0x00,
|
||||
0x00, 0x08, 0x14, 0x22, 0x41,
|
||||
0x14, 0x14, 0x14, 0x14, 0x14,
|
||||
0x00, 0x41, 0x22, 0x14, 0x08,
|
||||
0x02, 0x01, 0x59, 0x09, 0x06,
|
||||
0x3E, 0x41, 0x5D, 0x59, 0x4E,
|
||||
0x7C, 0x12, 0x11, 0x12, 0x7C,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x36,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x22,
|
||||
0x7F, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x41,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x01,
|
||||
0x3E, 0x41, 0x41, 0x51, 0x73,
|
||||
0x7F, 0x08, 0x08, 0x08, 0x7F,
|
||||
0x00, 0x41, 0x7F, 0x41, 0x00,
|
||||
0x20, 0x40, 0x41, 0x3F, 0x01,
|
||||
0x7F, 0x08, 0x14, 0x22, 0x41,
|
||||
0x7F, 0x40, 0x40, 0x40, 0x40,
|
||||
0x7F, 0x02, 0x1C, 0x02, 0x7F,
|
||||
0x7F, 0x04, 0x08, 0x10, 0x7F,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x06,
|
||||
0x3E, 0x41, 0x51, 0x21, 0x5E,
|
||||
0x7F, 0x09, 0x19, 0x29, 0x46,
|
||||
0x26, 0x49, 0x49, 0x49, 0x32,
|
||||
0x03, 0x01, 0x7F, 0x01, 0x03,
|
||||
0x3F, 0x40, 0x40, 0x40, 0x3F,
|
||||
0x1F, 0x20, 0x40, 0x20, 0x1F,
|
||||
0x3F, 0x40, 0x38, 0x40, 0x3F,
|
||||
0x63, 0x14, 0x08, 0x14, 0x63,
|
||||
0x03, 0x04, 0x78, 0x04, 0x03,
|
||||
0x61, 0x59, 0x49, 0x4D, 0x43,
|
||||
0x00, 0x7F, 0x41, 0x41, 0x41,
|
||||
0x02, 0x04, 0x08, 0x10, 0x20,
|
||||
0x00, 0x41, 0x41, 0x41, 0x7F,
|
||||
0x04, 0x02, 0x01, 0x02, 0x04,
|
||||
0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
0x00, 0x03, 0x07, 0x08, 0x00,
|
||||
0x20, 0x54, 0x54, 0x78, 0x40,
|
||||
0x7F, 0x28, 0x44, 0x44, 0x38,
|
||||
0x38, 0x44, 0x44, 0x44, 0x28,
|
||||
0x38, 0x44, 0x44, 0x28, 0x7F,
|
||||
0x38, 0x54, 0x54, 0x54, 0x18,
|
||||
0x00, 0x08, 0x7E, 0x09, 0x02,
|
||||
0x18, 0xA4, 0xA4, 0x9C, 0x78,
|
||||
0x7F, 0x08, 0x04, 0x04, 0x78,
|
||||
0x00, 0x44, 0x7D, 0x40, 0x00,
|
||||
0x20, 0x40, 0x40, 0x3D, 0x00,
|
||||
0x7F, 0x10, 0x28, 0x44, 0x00,
|
||||
0x00, 0x41, 0x7F, 0x40, 0x00,
|
||||
0x7C, 0x04, 0x78, 0x04, 0x78,
|
||||
0x7C, 0x08, 0x04, 0x04, 0x78,
|
||||
0x38, 0x44, 0x44, 0x44, 0x38,
|
||||
0xFC, 0x18, 0x24, 0x24, 0x18,
|
||||
0x18, 0x24, 0x24, 0x18, 0xFC,
|
||||
0x7C, 0x08, 0x04, 0x04, 0x08,
|
||||
0x48, 0x54, 0x54, 0x54, 0x24,
|
||||
0x04, 0x04, 0x3F, 0x44, 0x24,
|
||||
0x3C, 0x40, 0x40, 0x20, 0x7C,
|
||||
0x1C, 0x20, 0x40, 0x20, 0x1C,
|
||||
0x3C, 0x40, 0x30, 0x40, 0x3C,
|
||||
0x44, 0x28, 0x10, 0x28, 0x44,
|
||||
0x4C, 0x90, 0x90, 0x90, 0x7C,
|
||||
0x44, 0x64, 0x54, 0x4C, 0x44,
|
||||
0x00, 0x08, 0x36, 0x41, 0x00,
|
||||
0x00, 0x00, 0x77, 0x00, 0x00,
|
||||
0x00, 0x41, 0x36, 0x08, 0x00,
|
||||
0x02, 0x01, 0x02, 0x04, 0x02,
|
||||
0x3C, 0x26, 0x23, 0x26, 0x3C,
|
||||
0x1E, 0xA1, 0xA1, 0x61, 0x12,
|
||||
0x3A, 0x40, 0x40, 0x20, 0x7A,
|
||||
0x38, 0x54, 0x54, 0x55, 0x59,
|
||||
0x21, 0x55, 0x55, 0x79, 0x41,
|
||||
0x21, 0x54, 0x54, 0x78, 0x41,
|
||||
0x21, 0x55, 0x54, 0x78, 0x40,
|
||||
0x20, 0x54, 0x55, 0x79, 0x40,
|
||||
0x0C, 0x1E, 0x52, 0x72, 0x12,
|
||||
0x39, 0x55, 0x55, 0x55, 0x59,
|
||||
0x39, 0x54, 0x54, 0x54, 0x59,
|
||||
0x39, 0x55, 0x54, 0x54, 0x58,
|
||||
0x00, 0x00, 0x45, 0x7C, 0x41,
|
||||
0x00, 0x02, 0x45, 0x7D, 0x42,
|
||||
0x00, 0x01, 0x45, 0x7C, 0x40,
|
||||
0xF0, 0x29, 0x24, 0x29, 0xF0,
|
||||
0xF0, 0x28, 0x25, 0x28, 0xF0,
|
||||
0x7C, 0x54, 0x55, 0x45, 0x00,
|
||||
0x20, 0x54, 0x54, 0x7C, 0x54,
|
||||
0x7C, 0x0A, 0x09, 0x7F, 0x49,
|
||||
0x32, 0x49, 0x49, 0x49, 0x32,
|
||||
0x32, 0x48, 0x48, 0x48, 0x32,
|
||||
0x32, 0x4A, 0x48, 0x48, 0x30,
|
||||
0x3A, 0x41, 0x41, 0x21, 0x7A,
|
||||
0x3A, 0x42, 0x40, 0x20, 0x78,
|
||||
0x00, 0x9D, 0xA0, 0xA0, 0x7D,
|
||||
0x39, 0x44, 0x44, 0x44, 0x39,
|
||||
0x3D, 0x40, 0x40, 0x40, 0x3D,
|
||||
0x3C, 0x24, 0xFF, 0x24, 0x24,
|
||||
0x48, 0x7E, 0x49, 0x43, 0x66,
|
||||
0x2B, 0x2F, 0xFC, 0x2F, 0x2B,
|
||||
0xFF, 0x09, 0x29, 0xF6, 0x20,
|
||||
0xC0, 0x88, 0x7E, 0x09, 0x03,
|
||||
0x20, 0x54, 0x54, 0x79, 0x41,
|
||||
0x00, 0x00, 0x44, 0x7D, 0x41,
|
||||
0x30, 0x48, 0x48, 0x4A, 0x32,
|
||||
0x38, 0x40, 0x40, 0x22, 0x7A,
|
||||
0x00, 0x7A, 0x0A, 0x0A, 0x72,
|
||||
0x7D, 0x0D, 0x19, 0x31, 0x7D,
|
||||
0x26, 0x29, 0x29, 0x2F, 0x28,
|
||||
0x26, 0x29, 0x29, 0x29, 0x26,
|
||||
0x30, 0x48, 0x4D, 0x40, 0x20,
|
||||
0x38, 0x08, 0x08, 0x08, 0x08,
|
||||
0x08, 0x08, 0x08, 0x08, 0x38,
|
||||
0x2F, 0x10, 0xC8, 0xAC, 0xBA,
|
||||
0x2F, 0x10, 0x28, 0x34, 0xFA,
|
||||
0x00, 0x00, 0x7B, 0x00, 0x00,
|
||||
0x08, 0x14, 0x2A, 0x14, 0x22,
|
||||
0x22, 0x14, 0x2A, 0x14, 0x08,
|
||||
0xAA, 0x00, 0x55, 0x00, 0xAA,
|
||||
0xAA, 0x55, 0xAA, 0x55, 0xAA,
|
||||
0x00, 0x00, 0x00, 0xFF, 0x00,
|
||||
0x10, 0x10, 0x10, 0xFF, 0x00,
|
||||
0x14, 0x14, 0x14, 0xFF, 0x00,
|
||||
0x10, 0x10, 0xFF, 0x00, 0xFF,
|
||||
0x10, 0x10, 0xF0, 0x10, 0xF0,
|
||||
0x14, 0x14, 0x14, 0xFC, 0x00,
|
||||
0x14, 0x14, 0xF7, 0x00, 0xFF,
|
||||
0x00, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0x14, 0x14, 0xF4, 0x04, 0xFC,
|
||||
0x14, 0x14, 0x17, 0x10, 0x1F,
|
||||
0x10, 0x10, 0x1F, 0x10, 0x1F,
|
||||
0x14, 0x14, 0x14, 0x1F, 0x00,
|
||||
0x10, 0x10, 0x10, 0xF0, 0x00,
|
||||
0x00, 0x00, 0x00, 0x1F, 0x10,
|
||||
0x10, 0x10, 0x10, 0x1F, 0x10,
|
||||
0x10, 0x10, 0x10, 0xF0, 0x10,
|
||||
0x00, 0x00, 0x00, 0xFF, 0x10,
|
||||
0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x10, 0x10, 0x10, 0xFF, 0x10,
|
||||
0x00, 0x00, 0x00, 0xFF, 0x14,
|
||||
0x00, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0x00, 0x1F, 0x10, 0x17,
|
||||
0x00, 0x00, 0xFC, 0x04, 0xF4,
|
||||
0x14, 0x14, 0x17, 0x10, 0x17,
|
||||
0x14, 0x14, 0xF4, 0x04, 0xF4,
|
||||
0x00, 0x00, 0xFF, 0x00, 0xF7,
|
||||
0x14, 0x14, 0x14, 0x14, 0x14,
|
||||
0x14, 0x14, 0xF7, 0x00, 0xF7,
|
||||
0x14, 0x14, 0x14, 0x17, 0x14,
|
||||
0x10, 0x10, 0x1F, 0x10, 0x1F,
|
||||
0x14, 0x14, 0x14, 0xF4, 0x14,
|
||||
0x10, 0x10, 0xF0, 0x10, 0xF0,
|
||||
0x00, 0x00, 0x1F, 0x10, 0x1F,
|
||||
0x00, 0x00, 0x00, 0x1F, 0x14,
|
||||
0x00, 0x00, 0x00, 0xFC, 0x14,
|
||||
0x00, 0x00, 0xF0, 0x10, 0xF0,
|
||||
0x10, 0x10, 0xFF, 0x10, 0xFF,
|
||||
0x14, 0x14, 0x14, 0xFF, 0x14,
|
||||
0x10, 0x10, 0x10, 0x1F, 0x00,
|
||||
0x00, 0x00, 0x00, 0xF0, 0x10,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
|
||||
0xFF, 0xFF, 0xFF, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
|
||||
0x38, 0x44, 0x44, 0x38, 0x44,
|
||||
0x7C, 0x2A, 0x2A, 0x3E, 0x14,
|
||||
0x7E, 0x02, 0x02, 0x06, 0x06,
|
||||
0x02, 0x7E, 0x02, 0x7E, 0x02,
|
||||
0x63, 0x55, 0x49, 0x41, 0x63,
|
||||
0x38, 0x44, 0x44, 0x3C, 0x04,
|
||||
0x40, 0x7E, 0x20, 0x1E, 0x20,
|
||||
0x06, 0x02, 0x7E, 0x02, 0x02,
|
||||
0x99, 0xA5, 0xE7, 0xA5, 0x99,
|
||||
0x1C, 0x2A, 0x49, 0x2A, 0x1C,
|
||||
0x4C, 0x72, 0x01, 0x72, 0x4C,
|
||||
0x30, 0x4A, 0x4D, 0x4D, 0x30,
|
||||
0x30, 0x48, 0x78, 0x48, 0x30,
|
||||
0xBC, 0x62, 0x5A, 0x46, 0x3D,
|
||||
0x3E, 0x49, 0x49, 0x49, 0x00,
|
||||
0x7E, 0x01, 0x01, 0x01, 0x7E,
|
||||
0x2A, 0x2A, 0x2A, 0x2A, 0x2A,
|
||||
0x44, 0x44, 0x5F, 0x44, 0x44,
|
||||
0x40, 0x51, 0x4A, 0x44, 0x40,
|
||||
0x40, 0x44, 0x4A, 0x51, 0x40,
|
||||
0x00, 0x00, 0xFF, 0x01, 0x03,
|
||||
0xE0, 0x80, 0xFF, 0x00, 0x00,
|
||||
0x08, 0x08, 0x6B, 0x6B, 0x08,
|
||||
0x36, 0x12, 0x36, 0x24, 0x36,
|
||||
0x06, 0x0F, 0x09, 0x0F, 0x06,
|
||||
0x00, 0x00, 0x18, 0x18, 0x00,
|
||||
0x00, 0x00, 0x10, 0x10, 0x00,
|
||||
0x30, 0x40, 0xFF, 0x01, 0x01,
|
||||
0x00, 0x1F, 0x01, 0x01, 0x1E,
|
||||
0x00, 0x19, 0x1D, 0x17, 0x12,
|
||||
0x00, 0x3C, 0x3C, 0x3C, 0x3C
|
||||
])}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
|
||||
terminalfont = {"Width": 6, "Height": 8, "Start": 32, "End": 127, "Data": bytearray([
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x06, 0x5F, 0x06, 0x00,
|
||||
0x00, 0x07, 0x03, 0x00, 0x07, 0x03,
|
||||
0x00, 0x24, 0x7E, 0x24, 0x7E, 0x24,
|
||||
0x00, 0x24, 0x2B, 0x6A, 0x12, 0x00,
|
||||
0x00, 0x63, 0x13, 0x08, 0x64, 0x63,
|
||||
0x00, 0x36, 0x49, 0x56, 0x20, 0x50,
|
||||
0x00, 0x00, 0x07, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x3E, 0x41, 0x00, 0x00,
|
||||
0x00, 0x00, 0x41, 0x3E, 0x00, 0x00,
|
||||
0x00, 0x08, 0x3E, 0x1C, 0x3E, 0x08,
|
||||
0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,
|
||||
0x00, 0x00, 0xE0, 0x60, 0x00, 0x00,
|
||||
0x00, 0x08, 0x08, 0x08, 0x08, 0x08,
|
||||
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
|
||||
0x00, 0x20, 0x10, 0x08, 0x04, 0x02,
|
||||
0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,
|
||||
0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,
|
||||
0x00, 0x62, 0x51, 0x49, 0x49, 0x46,
|
||||
0x00, 0x22, 0x49, 0x49, 0x49, 0x36,
|
||||
0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,
|
||||
0x00, 0x2F, 0x49, 0x49, 0x49, 0x31,
|
||||
0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,
|
||||
0x00, 0x01, 0x71, 0x09, 0x05, 0x03,
|
||||
0x00, 0x36, 0x49, 0x49, 0x49, 0x36,
|
||||
0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,
|
||||
0x00, 0x00, 0x6C, 0x6C, 0x00, 0x00,
|
||||
0x00, 0x00, 0xEC, 0x6C, 0x00, 0x00,
|
||||
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
|
||||
0x00, 0x24, 0x24, 0x24, 0x24, 0x24,
|
||||
0x00, 0x00, 0x41, 0x22, 0x14, 0x08,
|
||||
0x00, 0x02, 0x01, 0x59, 0x09, 0x06,
|
||||
0x00, 0x3E, 0x41, 0x5D, 0x55, 0x1E,
|
||||
0x00, 0x7E, 0x11, 0x11, 0x11, 0x7E,
|
||||
0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,
|
||||
0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,
|
||||
0x00, 0x7F, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,
|
||||
0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,
|
||||
0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,
|
||||
0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,
|
||||
0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,
|
||||
0x00, 0x30, 0x40, 0x40, 0x40, 0x3F,
|
||||
0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,
|
||||
0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,
|
||||
0x00, 0x7F, 0x02, 0x04, 0x02, 0x7F,
|
||||
0x00, 0x7F, 0x02, 0x04, 0x08, 0x7F,
|
||||
0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,
|
||||
0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,
|
||||
0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,
|
||||
0x00, 0x7F, 0x09, 0x09, 0x19, 0x66,
|
||||
0x00, 0x26, 0x49, 0x49, 0x49, 0x32,
|
||||
0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,
|
||||
0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,
|
||||
0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,
|
||||
0x00, 0x3F, 0x40, 0x3C, 0x40, 0x3F,
|
||||
0x00, 0x63, 0x14, 0x08, 0x14, 0x63,
|
||||
0x00, 0x07, 0x08, 0x70, 0x08, 0x07,
|
||||
0x00, 0x71, 0x49, 0x45, 0x43, 0x00,
|
||||
0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,
|
||||
0x00, 0x02, 0x04, 0x08, 0x10, 0x20,
|
||||
0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,
|
||||
0x00, 0x04, 0x02, 0x01, 0x02, 0x04,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x00, 0x00, 0x03, 0x07, 0x00, 0x00,
|
||||
0x00, 0x20, 0x54, 0x54, 0x54, 0x78,
|
||||
0x00, 0x7F, 0x44, 0x44, 0x44, 0x38,
|
||||
0x00, 0x38, 0x44, 0x44, 0x44, 0x28,
|
||||
0x00, 0x38, 0x44, 0x44, 0x44, 0x7F,
|
||||
0x00, 0x38, 0x54, 0x54, 0x54, 0x08,
|
||||
0x00, 0x08, 0x7E, 0x09, 0x09, 0x00,
|
||||
0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,
|
||||
0x00, 0x7F, 0x04, 0x04, 0x78, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7D, 0x40, 0x00,
|
||||
0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,
|
||||
0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7F, 0x40, 0x00,
|
||||
0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,
|
||||
0x00, 0x7C, 0x04, 0x04, 0x78, 0x00,
|
||||
0x00, 0x38, 0x44, 0x44, 0x44, 0x38,
|
||||
0x00, 0xFC, 0x44, 0x44, 0x44, 0x38,
|
||||
0x00, 0x38, 0x44, 0x44, 0x44, 0xFC,
|
||||
0x00, 0x44, 0x78, 0x44, 0x04, 0x08,
|
||||
0x00, 0x08, 0x54, 0x54, 0x54, 0x20,
|
||||
0x00, 0x04, 0x3E, 0x44, 0x24, 0x00,
|
||||
0x00, 0x3C, 0x40, 0x20, 0x7C, 0x00,
|
||||
0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,
|
||||
0x00, 0x3C, 0x60, 0x30, 0x60, 0x3C,
|
||||
0x00, 0x6C, 0x10, 0x10, 0x6C, 0x00,
|
||||
0x00, 0x9C, 0xA0, 0x60, 0x3C, 0x00,
|
||||
0x00, 0x64, 0x54, 0x54, 0x4C, 0x00,
|
||||
0x00, 0x08, 0x3E, 0x41, 0x41, 0x00,
|
||||
0x00, 0x00, 0x00, 0x77, 0x00, 0x00,
|
||||
0x00, 0x00, 0x41, 0x41, 0x3E, 0x08,
|
||||
0x00, 0x02, 0x01, 0x02, 0x01, 0x00,
|
||||
0x00, 0x3C, 0x26, 0x23, 0x26, 0x3C
|
||||
])}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
|
||||
ds3231 Battery Backup Clock:
|
||||
Blue connected to X9
|
||||
Yellow connected to X10
|
||||
|
||||
TFT Display:
|
||||
SCL Green connected to X6
|
||||
SDA yellow connected to X8
|
||||
DC Blue connected to X1
|
||||
RES yellow connected to X2
|
||||
CS black connected to X5
|
||||
|
Ładowanie…
Reference in New Issue