Esempio n. 1
0
  def __init__(self):

    self.dbclient = influxdb.InfluxDBClient(
        INFLUX_HOST, 8086, database=INFLUX_DB)

    self.displays = []
    start_addr = 0x70

    for i in range(4):
      addr = start_addr + i
      print "Connecting to %i" % i
      disp = AlphaNum4.AlphaNum4(address=addr)
      disp.begin()
      disp.set_brightness(15)
      disp.clear()
      disp.write_display()
      self.displays.append(disp)

    # For rotary encoder
    self.threshold = 4
    self.counter = 0
    self.last = 1

    # Menu position
    self.menu_items = [self.identify,
                       self.show_temp, self.show_current_conditions]
    self.current_index = 0

    # Current Current_Conditions
    self.current_conditions = Current_Conditions()
    self.current_conditions.update_weather()
Esempio n. 2
0
 def __init__(self):
     """init function: imports adafruit alphanumeric display class and begins"""
     # write to error.log file
     self.display_lib = AlphaNum4.AlphaNum4()
     self.display_lib.begin()
     self.display_in_use = False
     logger.info('display-module initialized')
Esempio n. 3
0
 def __init__(self,
              address='0x70',
              brightness='15',
              decimal_digits='0',
              justify_right='True'):
     """Create an instance of the quad alpha-numeric display widget.  Can pass
     in the following optional parameters to control the widget (note all
     parameters are strings as they are parsed from config files):
       - address: I2C address, default is 0x70
       - brightness: Brightness of the display, can be a value from 0 to 15
                     with 15 being the brightest.  The default is 15.
       - decimal_digits: Number of digits to show after decimal point, default
                         is 0.
       - justify_right: Justify numeric display to the right side if true (the
                        default).  Set to false to justify to the left side.
     """
     # Setup display and initial state.
     self._display = AlphaNum4.AlphaNum4(address=int(address, 0))
     self._display.begin()
     self._display.set_brightness(int(brightness))
     self._decimal_digits = int(decimal_digits)
     self._justify_right = self.parse_bool(justify_right)
     # Clear the display
     self._display.clear()
     self._display.write_display()
Esempio n. 4
0
    def __init__(self):
        ### SETUP DISPLAYS #################
        self.currentLapDisplay = SevenSegment.SevenSegment(address=0x72)
        self.currentLapDisplay.begin()
        self.currentLapDisplay.clear()

        self.previousLapDisplay = SevenSegment.SevenSegment(address=0x73)
        self.previousLapDisplay.begin()
        self.previousLapDisplay.clear()

        self.multiDisplay = AlphaNum4.AlphaNum4(address=0x70)
        self.multiDisplay.begin()
        self.multiDisplay.clear()
        ####################################

        self.displayTime(0, 0)
        self.textIndex = 0
Esempio n. 5
0
# Example of using the MQTT client class to subscribe to and publish feed values.
# Author: Tony DiCola

# Import standard python modules.
import random
import sys
import time

# Import Adafruit IO MQTT client.
from Adafruit_IO import MQTTClient

from Adafruit_LED_Backpack import AlphaNum4

# Create display instance on default I2C address (0x70) and bus number.
display = AlphaNum4.AlphaNum4()

# Initialize the display. Must be called once before using the display.
display.begin()
display.set_brightness(2)

myText = "STRT"

# Set to your Adafruit IO key.
# Remember, your key is a secret,
# so make sure not to publish it when you publish this code!
ADAFRUIT_IO_KEY = 'yourkey'

# Set to your Adafruit IO username.
# (go to https://accounts.adafruit.com to find your username)
ADAFRUIT_IO_USERNAME = '******'
Esempio n. 6
0
    ws = f.readline().strip()
    if ws == '1':
        result = 1

    return result


#####################################################################################

# Initialise displays
matrix = BicolorMatrix8x8.BicolorMatrix8x8(address=MATRIX_ADDRESS,
                                           busnum=I2C_BUS)
matrix.begin()
matrix.set_brightness(BRIGHTNESS)

alpha = AlphaNum4.AlphaNum4(address=ALPHA_ADDRESS, busnum=I2C_BUS)
alpha.begin()
alpha.set_brightness(BRIGHTNESS)

# Scroll a message across the display
current_alpha = 0
status = list()
current_status = 0
try:
    while True:

        drawAlphaText(alpha, current_alpha)

        current_alpha += 1
        if current_alpha == len(ALPHA_LETTERS):
            current_alpha = 0
Esempio n. 7
0
# Import Adafruit modules that drive the hardware
import Adafruit_ADS1x15  # Required for ADS1x15 Analog to Digital Converter
from Adafruit_LED_Backpack import AlphaNum4  # Required for 14 segment AlphaNumeric Display

####################################
# Initialize objects
####################################

# Create instance of an ADS1115 ADC (16-bit)
adc = Adafruit_ADS1x15.ADS1115(address=0x48, busnum=1)

# Create instances of displays with a specific I2C address and/or bus.
# Also create empty string in messagelist for each display
for d in range(len(displayaddr)):
    displaylist.append(AlphaNum4.AlphaNum4(address=displayaddr[d], busnum=1))
    messagelist.append("    ")

# Initialize the displays
for d in range(len(displaylist)):
    displaylist[d].begin()

# Set brightness of all displays
set_display_brightness(bright)

####################################
# Initialize GPIO boards and pins
####################################
# Initialize GPIO board to BCM mode where pin numbers defined by Broadcom SOC Channel
# You can set this to GPIO.BOARD mode but then you will have to define pins according to pi header (e.g. 1 to 40)
GPIO.setmode(GPIO.BCM)
Esempio n. 8
0
 def __init__(self):
     AbstractDisplay.__init__(self)
     from Adafruit_LED_Backpack import AlphaNum4
     self.alphanum_display = AlphaNum4.AlphaNum4()
     self.alphanum_display.begin()
Esempio n. 9
0
 def __init__(self):
     self.display = AlphaNum4.AlphaNum4()
     self.display.begin()
Esempio n. 10
0
# Init Timezone Variables
offset = 0
timezones = [['UTC', 0], ['HST', -10], ['HDT', -9], ['AKST', -9], ['AKDT', -8],
             ['PST', -8], ['PDT', -7], ['MST', -7], ['MDT', -6], ['CST', -6],
             ['CDT', -5], ['EST', -5], ['EDT', -4], ['AST', -4], ['ADT', -3]]

# Init GPIO for buttons
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_UP)

# Creates displays
ssegdisplay = sseg.SevenSegment(address=0x70)
alphadisplay = alphanum.AlphaNum4(address=0x71)

# Begin and reset display
ssegdisplay.begin()
ssegdisplay.clear()
ssegdisplay.write_display()

alphadisplay.begin()
alphadisplay.clear()
alphadisplay.print_str(timezones[offset][0])
alphadisplay.write_display()


# Prints UTC time, for testing purposes
#print(datetime.utcnow())
Esempio n. 11
0
import includes.data as data
from datetime import datetime
mc = memcache.Client(['127.0.0.1:11211'], debug=0)
from Adafruit_LED_Backpack import SevenSegment
from Adafruit_LED_Backpack import AlphaNum4

import RPi.GPIO as GPIO

# setup alarm on / off LED
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(16,GPIO.OUT)

# 7 Segment Clock on i2c on address 0x70
segment = SevenSegment.SevenSegment(address=0x71)
display = AlphaNum4.AlphaNum4(address=0x71)

# initialize the display, must be called once before using the display
segment.begin()
segment.set_brightness(3)
segment.set_colon(True)

# get total number of gradients set for the light bar
path, dirs, files = next(os.walk("/home/pi/SolarBar/gradients"))
totalGradients = len(files)

def toggleAlarmOnLight(alarmSet):
    """toggle alarm on light"""
    print alarmSet
    if alarmSet == 'True':
        GPIO.output(16,GPIO.HIGH)
Esempio n. 12
0
#! /usr/bin/python
# player script to listen for select score board "type" button press
# Kevin Hinds http://www.kevinhinds.com
# License: GPL 2.0
import sys, time, json, string, cgi, subprocess, json, datetime, memcache
from gpiozero import Button
from Adafruit_LED_Backpack import AlphaNum4
mc = memcache.Client(['127.0.0.1:11211'], debug=0)

# setup the alphanumeric displays
displayOne = AlphaNum4.AlphaNum4(address=0x77)
displayOne.begin()
displayOne.set_brightness(8)
displayOne.clear()

displayTwo = AlphaNum4.AlphaNum4(address=0x76)
displayTwo.begin()
displayTwo.set_brightness(8)
displayTwo.clear()


def displayType(scoreBoardType):
    """set the ALPHNUM to scoreBoardType string value, with some padded spaces"""
    scoreBoardType = str(scoreBoardType)
    scoreBoardType = " " + scoreBoardType + "  "

    displayOne.clear()
    displayOne.print_str(scoreBoardType[0:4])
    displayOne.write_display()

    displayTwo.clear()