OrangePI

Iš Žinynas.
Jump to navigation Jump to search

Pins

OPiLite pinout.jpg

Pins with names (Rasp compatible)

Orangepi pins.png

Ledu palaikymo ijungimas armbian stretch distribucijoje

/boot/armbianEnv.txt

overlay_prefix=sun8i-h3
overlays=spi-spidev
param_spidev_spi_bus=0

max7219 libo idiegimas

apt-get install python-setuptools build-essential python-dev zlib1g-dev libjpeg62-turbo-dev 
git clone https://github.com/rm-hull/luma.led_matrix.git
python setup.py build
python setup.py install

Keletas scriptu

/usr/local/bin/piesti_lcd

#!/usr/bin/env python
# settings
leds=8 # ledu blocku kiekis
orientation=-90 # orientacija
rotate=2 # koks rotate


from luma.led_matrix.device import max7219
from luma.core.interface.serial import spi, noop
from luma.core.render import canvas
from luma.core.virtual import viewport
from luma.core.legacy import text, show_message
from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FONT, LCD_FONT

import time
import re
import argparse
from random import randrange


def goled(text,speed,repeat):
   print "Sending to led: "+text+" at speed:",speed
   serial = spi(port=0, device=0, gpio=noop())
   device = max7219(serial, cascaded=leds, block_orientation=orientation, rotate=rotate)
   for x in range(0, repeat):
      if speed>0:
        show_message(device, text, fill="white", font=proportional(CP437_FONT), scroll_delay=speed)
      else:
         show_message(device, text, fill="white", font=proportional(CP437_FONT))

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='led writer arguments',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument('--text', '-t', type=str, default='Hello World', help='Write some text to display on the leds!')
    parser.add_argument('--speed', type=float, default=0, help='Sets text speed')
    parser.add_argument('--repeat', type=int, default=1, choices=[1, 2, 3], help='Repeat text n times')

    args = parser.parse_args()

    try:
        goled(args.text,args.speed,args.repeat)
    except KeyboardInterrupt:
        pass

/usr/local/bin/lcd_server

#!/usr/bin/env python

# settings
leds=8 # ledu blocku kiekis
orientation=-90 # orientacija
rotate=2 # koks rotate


from luma.led_matrix.device import max7219
from luma.core.interface.serial import spi, noop
from luma.core.render import canvas
from luma.core.virtual import viewport
from luma.core.legacy import text, show_message
from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FONT, LCD_FONT

import time
import re
import argparse
from random import randrange
import socket

def goled(data):
   speed,repeat,text = data.split("::")
   print "Sending to led: "+text+" at speed:",float(speed)
   serial = spi(port=0, device=0, gpio=noop())
   device = max7219(serial, cascaded=leds, block_orientation=orientation, rotate=rotate)
   for x in range(0, int(repeat)):
      if float(speed)>0:
        show_message(device, text, fill="white", font=proportional(CP437_FONT), scroll_delay=float(speed))
      else:
         show_message(device, text, fill="white", font=proportional(CP437_FONT))

# Create a socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Ensure that you can restart your server quickly when it terminates
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

# Set the client socket's TCP "well-known port" number
well_known_port = 8881
sock.bind(('0.0.0.0', well_known_port))

# Set the number of clients waiting for connection that can be queued
sock.listen(5)

# loop waiting for connections (terminate with Ctrl-C)
try:
    while 1:
        newSocket, address = sock.accept(  )
        print "Connected from", address
        # loop serving the new client
        while 1:
            receivedData = newSocket.recv(1024)
            if not receivedData: break
            # Echo back the same data you just received
            goled(receivedData)
            newSocket.send("OK")
        newSocket.close(  )
        print "Disconnected from", address
finally:
    sock.close(  )

Crashfix naudojant įvairių gamintojų webcam'us

/etc/modprobe.d/uvcvideo.conf  

options uvcvideo nodrop=1 timeout=5000 quirks=0x80

Taip pat galima bandyti kitą metodą Raspberry usb reset.