import adafruit_sharpmemorydisplay
import time

# Colors
BLACK = 0
WHITE = 255

# Parameters to Change
BORDER = 3
FONTSIZE = 50

spi = busio.SPI(board.SCK, MOSI=board.MOSI)
scs = digitalio.DigitalInOut(board.D22)  # inverted chip select

# display = adafruit_sharpmemorydisplay.SharpMemoryDisplay(spi, scs, 96, 96)
display = adafruit_sharpmemorydisplay.SharpMemoryDisplay(spi, scs, 400, 240)

# Clear display.
display.fill(1)
display.show()

# Create blank image for drawing.
# Make sure to create image with mode '1' for 1-bit color.
#image = Image.new("1", (display.width, display.height))

# Get drawing object to draw on image.
#draw = ImageDraw.Draw(image)

# Draw a black background
#draw.rectangle((0, 0, display.width, display.height), outline=BLACK, fill=BLACK)
示例#2
0
import time
import board
import busio
import digitalio

import adafruit_sharpmemorydisplay

# Initialize SPI bus and control pins
spi = busio.SPI(board.SCK, MOSI=board.MOSI)
scs = digitalio.DigitalInOut(board.D6)  # inverted chip select

# pass in the display size, width and height, as well
# display = adafruit_sharpmemorydisplay.SharpMemoryDisplay(spi, scs, 96, 96)
display = adafruit_sharpmemorydisplay.SharpMemoryDisplay(spi, scs, 144, 168)

print("Pixel test")

# Clear the display.  Always call show after changing pixels to make the display
# update visible!
display.fill(1)
display.show()

# Set a pixel in the origin 0,0 position.
display.pixel(0, 0, 0)
# Set a pixel in the middle position.
display.pixel(display.width // 2, display.width // 2, 0)
# Set a pixel in the opposite corner position.
display.pixel(display.width - 1, display.height - 1, 0)
display.show()
time.sleep(2)
示例#3
0
rtc.ntp_sync('pool.ntp.org')
time.sleep(2)

# create LoRa-socket
lora = LoRa(mode=LoRa.LORA, region=LoRa.EU868)
s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)

# the display is a SHARP Memory Display Breakout - 1.3" 96x96 Silver Monochrome
# https://www.exp-tech.de/displays/lcd/5090/sharp-memory-display-breakout-1.3-96x96-silver-monochrome
# this uses the Lopys SPI default pins for CLK, MOSI and MISO (``P10``, ``P11`` and ``P14``)
spi = SPI(0, mode=SPI.MASTER, baudrate=2000000, polarity=0, phase=0)
# define a dedicated pin for CS
scs = Pin('P9', mode=Pin.OUT)

# pass in the display size, width and height, as well
display = adafruit_sharpmemorydisplay.SharpMemoryDisplay(spi, scs, 96, 96)

# set the display rotation (possible values: 0, 1, 2, 3)
display.rotation = 0

def recLoRa(delay, id, dataArray):
    print("now listening ...")
    # check lora-interface for sensor-data
    s.setblocking(False)
    data = ""
    # listen as long as the received data-length is lower 8 byte
    while len(data) < 8:
        data = s.recv(64)
        time.sleep_ms(delay)
    # if received data larger than 8 byte continue
    if len(data) >= 8: