コード例 #1
0
ファイル: run_clock.py プロジェクト: DakotaHoosier/hack-clock
#!/usr/bin/python

import time
import datetime
from Libs.Clock import Clock
from Libs.SevenSegment import Display
from Libs.GStreamer import Speaker

# Connect to the internal machine clock
clock = Clock()

# Connect to the LED display
display = Display()

# Connect to the speaker
speaker = Speaker()

# Play some music
def playMusic():
    speaker.playList(["TestTrack.ogg", "AmicusMeus.ogg"])


# Wake us up at 8:30 in the morning
clock.atTime(8, 30, playMusic)

# Show the current time
def showCurrentTime():
    now = datetime.datetime.now()

    # Set the hours
    is_evening = now.hour > 12
コード例 #2
0
ファイル: run_clock.py プロジェクト: DakotaHoosier/hack-clock
#!/usr/bin/python

import time
import datetime
from Libs.Clock import Clock
from Libs.SevenSegment import Display

# Connect to the internal machine clock
clock = Clock()

# Connect to the LED display
display = Display()

# Set the indicator lights
display.setColon(True)
display.setEvening(False)

# Set the hours
display.setHours(0)

# Set the minutes
display.setMinutes(0)

# Set the brightness (0 to 15, 15 is the brightest)
display.setBrightness(1)