Exemplo n.º 1
0
def scrollRL(thing):
	for i in range(16):
		thingf = float(thing)
		valf = float(thingf/2**i)
		lower = valf - int(valf)
		MAX7219array.send_matrix_reg_byte(0, 1, int(valf))
		MAX7219array.send_matrix_reg_byte(1,1, int(lower*256))
		time.sleep(0.5)
Exemplo n.º 2
0
def display_scroll_char(char, matrix):
	temp = int(char)

	for n in range(8):		
		for i in range(8):
			MAX7219array.send_matrix_reg_byte(matrix, i+1, numbers[temp][i]*2**n)
		time.sleep(0.1)
		MAX7219array.clear_all()
Exemplo n.º 3
0
def scrollLR(thing):
	for i in range(16):
		val = thing*2**i
		print(val)
		MAX7219array.send_matrix_reg_byte(1, 1, val)
		if val > 128:
			MAX7219array.send_matrix_reg_byte(0, 1, val/256)
		time.sleep(0.2)
Exemplo n.º 4
0
def scroll_letter(letter, matrix):
	for i in range(len(characters)):
		if characters[i][1] == letter:
			print(str(letter) + ' is ' + str(characters[i][0]))
			for n in range(8):
				for j in range(8):
					MAX7219array.send_matrix_reg_byte(matrix, j+1, characters[i][0][j]*2**n)
				time.sleep(0.1)
				MAX7219array.clear_all()
Exemplo n.º 5
0
 def action(self):
     led_panel.init()
     self.curr_message = "aktos"
     self.prev_message = None
     while True:
         if self.curr_message != self.prev_message:
             led_panel.static_message(self.curr_message)
             self.prev_message = self.curr_message
         sleep(0.01)
Exemplo n.º 6
0
def drawEyes():
	global window, centerX, centerY, leftEye, rightEye, x11
	if x11:
		for x in range(8):
			for y in range(8):
				#left eye
				val = (leftEye.current[y] & 1 << 7-x) != 0
				window.addstr(centerY+y-4, centerX+x-10, '8' if val else ' ')
				#right eye
				val = (rightEye.current[y] & 1 << 7-x) != 0
				window.addstr(centerY+y-4, centerX+x+2, '8' if val else ' ')
		window.refresh()

	leftEye.update()
	rightEye.update()

	for y in range(8):
		m7219.send_matrix_reg_byte(0, y+1, leftEye.current[y])
		m7219.send_matrix_reg_byte(1, y+1, rightEye.current[y])
Exemplo n.º 7
0
def show_time():
	print(time.strftime('%H:%M'))
	hour = time.strftime('%H')
	minu = time.strftime('%M')

	
	display(hour[0], 1)
	display(hour[1], 0)

	time.sleep(0.5)

	MAX7219array.clear_all()

	time.sleep(0.1)

	display_scroll_char(10, 1) #: is 10 in chars
	display_scroll_char(10, 0) #: is 10 in chars

	display(minu[0], 1)
	display(minu[1], 0)

	time.sleep(0.5)

	MAX7219array.clear_all()
Exemplo n.º 8
0
def scroll_letter_LR(letter):
	for i in range(len(characters)):
		if characters[i][1] == letter:
			print(str(letter) + ' is ' + str(characters[i][0]))
			for n in range(16):
				for j in range(8):
					MAX7219array.send_matrix_reg_byte(1, j+1, characters[i][0][j]*2**n)
					if characters[i][0][j]*2**n >128:
						nextDisplay = characters[i][0][j]*2**n/256
						MAX7219array.send_matrix_reg_byte(0, j+1, nextDisplay)

				time.sleep(0.1)
				MAX7219array.clear_all()
Exemplo n.º 9
0
def scroll_letter_RL(letter):
	for i in range(len(characters)):
		if characters[i][1] == letter:
			print(str(letter) + ' is ' + str(characters[i][0]))
			for n in range(16):
				for j in range(8):
					thing = characters[i][0][j]
					thingf = float(thing)
					valf = float(thingf/2**n)
					lower = valf - int(valf)
					MAX7219array.send_matrix_reg_byte(0, j+1, int(valf))
					MAX7219array.send_matrix_reg_byte(1, j+1, int(lower*256))

				time.sleep(0.1)
				MAX7219array.clear_all()
Exemplo n.º 10
0
import time
from random import randrange

# Import library
import MAX7219array as m7219
# Import fonts
from MAX7219fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT

# The following imported variables make it easier to feed parameters to the library functions
from MAX7219array import DIR_L, DIR_R, DIR_U, DIR_D
from MAX7219array import DIR_LU, DIR_RU, DIR_LD, DIR_RD
from MAX7219array import DISSOLVE, GFX_ON, GFX_OFF, GFX_INVERT

# Initialise the library and the MAX7219/8x8LED array
m7219.init()

try:

    # Display a stationary message
    m7219.static_message("Welcome!")
    time.sleep(2)
    m7219.clear_all()

    # Cycle through the range of brightness levels - up then down
    m7219.brightness(0)
    m7219.static_message("Bright ?")
    for loop in range(2):
        for brightness in range(15*(loop%2), 16-17*(loop%2), 1-2*(loop%2)):
            m7219.brightness(brightness)
            time.sleep(0.1)
Exemplo n.º 11
0
#!/usr/bin/env python
import MAX7219array as m7219
from MAX7219fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT
from MAX7219array import DIR_L, DIR_R, DIR_U, DIR_D
import sys
import time
import fileinput

if len(sys.argv) == 1:
    for line in sys.stdin:
        m7219.init()
        m7219.brightness(1)
        m7219.scroll_message_horiz(line.rstrip(), 1, 8, DIR_L, CP437_FONT)
        m7219.clear_all()
        #print(line)
    sys.exit(0)
print sys.argv
m7219.init()
prev = ''
for word in sys.argv[1:]:
    #print word
    m7219.scroll_message_vert(prev, word,  direction=1)
    prev = word
Exemplo n.º 12
0
import time
from random import randrange

# Import library
import MAX7219array as m7219
# Import fonts
from MAX7219fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT

# The following imported variables make it easier to feed parameters to the library functions
from MAX7219array import DIR_L, DIR_R, DIR_U, DIR_D
from MAX7219array import DIR_LU, DIR_RU, DIR_LD, DIR_RD
from MAX7219array import DISSOLVE, GFX_ON, GFX_OFF, GFX_INVERT

# Initialise the library and the MAX7219/8x8LED array
m7219.init()

try:

    # Display a stationary message
    m7219.static_message("Welcome!")
    time.sleep(2)
    m7219.clear_all()

    # Cycle through the range of brightness levels - up then down
    m7219.brightness(0)
    m7219.static_message("Bright ?")
    for loop in range(2):
        for brightness in range(15 * (loop % 2), 16 - 17 * (loop % 2),
                                1 - 2 * (loop % 2)):
            m7219.brightness(brightness)
Exemplo n.º 13
0
import MAX7219array as m7219
# Import fonts
from MAX7219fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT

# The following imported variables make it easier to feed parameters to the library functions
from MAX7219array import DIR_L, DIR_R, DIR_U, DIR_D
from MAX7219array import DIR_LU, DIR_RU, DIR_LD, DIR_RD
from MAX7219array import DISSOLVE, GFX_ON, GFX_OFF, GFX_INVERT

# initialize GPIO
gpio.setwarnings(False)
gpio.setmode(gpio.BCM)
gpio.cleanup()

# Initialise the library and the MAX7219/8x8LED array
m7219.init()

green_pin = 26  # normal
red_pin = 19  # hot
blue_pin = 5  # cold
yellow_pin = 13  # gas
white_pin = 12  # environment

gpio.setmode(gpio.BCM)
gpio.setup(green_pin, gpio.OUT)
gpio.setup(red_pin, gpio.OUT)
gpio.setup(blue_pin, gpio.OUT)
gpio.setup(yellow_pin, gpio.OUT)
gpio.setup(white_pin, gpio.OUT)

gpio.output(green_pin, True)
Exemplo n.º 14
0
def running_dot():
	print("running_dot")
	
	MAX7219array.send_all_reg_byte(1, 255)
	MAX7219array.send_all_reg_byte(8, 255)
	for i in range(6):
		MAX7219array.send_matrix_reg_byte(0, i+2, 128)
	for i in range(6):
		MAX7219array.send_matrix_reg_byte(1, i+2, 1)

	ring=[127, 191, 223, 239, 247, 251, 253, 254,255]
	ring2=[254, 253, 251, 247, 239, 223, 191, 127, 255]

	for i in range(2):
		for n in range(8):
			MAX7219array.send_matrix_reg_byte(i, 1, ring[n])
			time.sleep(0.04)
		MAX7219array.send_matrix_reg_byte(i, 1, ring[8])

	for i in range(6):
		MAX7219array.send_matrix_reg_byte(1, i+2, 0)
		time.sleep(0.04)
		MAX7219array.send_matrix_reg_byte(1, i+2, 1)

	for i in range(2):
		for n in range(8):
			MAX7219array.send_matrix_reg_byte(1-i, 8, ring2[n])
			time.sleep(0.04)
		MAX7219array.send_matrix_reg_byte(1-i, 8, ring2[8])

	for i in range(5):
		MAX7219array.send_matrix_reg_byte(0, 6-i, 0)
		time.sleep(0.04)
		MAX7219array.send_matrix_reg_byte(0, 6-i, 128)
Exemplo n.º 15
0
def display(char, matrix):
	temp = int(char)

	for i in range(8):
		MAX7219array.send_matrix_reg_byte(matrix, i+1, numbers[temp][i])
Exemplo n.º 16
0
import os
import io
import picamera
import time
import numpy
import threading
from eye import Eye

import MAX7219array as m7219
from MAX7219fonts import CP437_FONT, SINCLAIRS_FONT, LCD_FONT, TINY_FONT
from MAX7219array import DIR_L, DIR_R, DIR_U, DIR_D
from MAX7219array import DIR_LU, DIR_RU, DIR_LD, DIR_RD
from MAX7219array import DISSOLVE, GFX_ON, GFX_OFF, GFX_INVERT

# Initialise the LED array
m7219.init()
#m7219.brightness(0)


leftEye = Eye()
rightEye = Eye()

window = 0
centerX = 0
centerY = 0

cameraWidth = 160# * 2
cameraHeight = 120# * 2


def processImage(t0, t1, t2):
Exemplo n.º 17
0
def show_letter(letter):
	for i in range(len(characters)):
		if characters[i][1] == letter:
			print(str(letter) + ' is ' + str(characters[i][0]))
			for j in range(8):
				MAX7219array.send_matrix_reg_byte(1, j+1, characters[i][0][j])
Exemplo n.º 18
0
import MAX7219array as led_panel

led_panel.init()
led_panel.static_message("hello")
Exemplo n.º 19
0
def scrollRL(thing):
	for i in range(16):
		thingf = float(thing)
		valf = float(thingf/2**i)
		lower = valf - int(valf)
		MAX7219array.send_matrix_reg_byte(0, 1, int(valf))
		MAX7219array.send_matrix_reg_byte(1,1, int(lower*256))
		time.sleep(0.5)
			


##############################################################################
#MAIN
##############################################################################
MAX7219array.init()

# d1 = [63, 12, 12, 12, 12, 14, 12, 0]
# d2 = [63, 51, 6, 28, 48, 51, 30, 0]
# d3 = [30, 51, 48, 28, 48, 51, 30, 0]
# d4 = [120, 48, 127, 51, 54, 60, 56, 0]
# d5 = [30, 51, 48, 48, 31, 3, 63, 0]
# d6 = [30, 51, 51, 31, 3, 6, 28, 0]
# d7 = [12, 12, 12, 24, 48, 51, 63, 0]
# d8 = [30, 51, 51, 30, 51, 51, 30, 0]
# d9 = [14, 24, 48, 62, 51, 51, 30, 0]
# d0 = [62, 103, 111, 123, 115, 99, 62, 0]

numbers = [
[62, 103, 111, 123, 115, 99, 62, 0], 				#0
[63, 12, 12, 12, 12, 14, 12, 0], 					#1