# autor : colson (Yeong Jun Kim)
# https://www.github.com/YeongJunKim

from aiy_led import MyLed
from aiy_log import MyLogger
from aiy_play import MyAudio
from aiy_rec import MyRec
import logging
import aiy.voicehat
import datetime
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)

logger = MyLogger(level=logging.DEBUG, get="MAIN")
led = MyLed()
audio = MyAudio()
rec = MyRec()

startFlag = 0
stopFlag = 0


def setup():
    logger.add_file_stream_handler("logger.log")


def button_callback():
    print("button callback")
    global startFlag
    if startFlag == 0:
        startFlag = 1
Пример #2
0
 def __init__(self, led=(0x00, 0x00, 0x00)):
     self.logger = MyLogger(level=logging.INFO, get="LED")
     self.leds = Leds()
     self.leds.update(Leds.rgb_on(led))
     self.logger.logger.debug("Init LED drivers")
Пример #3
0
 def __init__(self):
     logger = MyLogger(level=logging.INFO, get="AUDIO")
     logger.logger.debug("Init audio driver")
 def __init__(self):
     self.button = aiy.voicehat.get_button()
     self.button.__init__(button.channel, GPIO.RISING)
     self.button.on_press(self.raise_buttonout)
     self.logger = MyLogger(level=logging.DEBUG, get="BUTTON")
     self.logger.logger.debug('init')
Пример #5
0
import logging
import time
import aiy.voicehat
import threading
import datetime
import RPi.GPIO as GPIO
from aiy_led import MyLed
from aiy_log import MyLogger
from aiy_play import MyAudio

GPIO.setmode(GPIO.BCM)

button = aiy.voicehat.get_button()
led = MyLed()
play = MyAudio()
logger = MyLogger(level=logging.INFO, get="MAIN")

startFlag = 0
audio = 0
stream = 0
timeCnt = 0
timeout = 0
timerStart = 0
timeExitFlag = 0


def timer():
    global timeCnt
    global timeExitFlag
    global timerStart
    logger.logger.debug("timer_1")
Пример #6
0
import logging
from aiy_log import MyLogger
import threading
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)

logger = MyLogger(level=logging.DEBUG, get="THREAD")


class ButtonCheck(threading.Thread):
    #
    # def __init__(self):
    #     super(ButtonCheck, self).__init__()
    #     logger.logger.debug(threading.currentThread().getName())

    def run(self):
        while True:
            if GPIO.input(23) == 0:
                print(threading.currentThread().getName())


Пример #7
0
 def __init__(self):
     self.button = aiy.voicehat.get_button()
     self.logger = MyLogger(level=logging.DEBUG, get="BUTTON")
     self.logger.add_file_stream_handler('logger.log')
Пример #8
0
 def __init__(self):
     self.logger = MyLogger(level=logging.DEBUG, get="REC")
     self.logger.add_file_stream_handler("logger.log")
     self.logger.logger.debug("Init REC drivers")
     self.proc = 0