Beispiel #1
0
def button_select_click(channel):
    global current_mode, ready_to_shutdown, automatic_mode
    automatic_mode = True
    if current_mode == MODE_STOP:
        if not ready_to_shutdown:
            display("STP?")
            ready_to_shutdown = True
        else:
            display("SHUT")
        if not (EXTERNAL_DEBUG_MODE):
            GPIO.cleanup()
            os.system("sudo shutdown now -h")
        else:
            print("DEBUG : SHUTDOWN BUTTON CLICKED")
            exit
    else:
        if not (_current is None):
            _current.onSelect()
Beispiel #2
0
def button_select_click(channel):
    global current_mode, ready_to_shutdown, automatic_mode
    automatic_mode = True
    if current_mode == MODE_STOP:
        if not ready_to_shutdown :
            display("STP?")
            ready_to_shutdown = True
        else :
            display("SHUT")
	    if not(EXTERNAL_DEBUG_MODE):
		GPIO.cleanup()
	        os.system("sudo shutdown now -h")
	    else:
		print("DEBUG : SHUTDOWN BUTTON CLICKED")
	    exit
    else :
        if not(_current is None):
            _current.onSelect()
Beispiel #3
0
    from DBG_busgo import BusGo
    from DBG_display import Display
else:
    from led_communication import LedCommunication
    from receiver import Receiver
    import RPi.GPIO as GPIO
    from busgo import BusGo
    from display import Display

#********************* Init GPIO
#led_working = 19
#led_power = 22
button_select_in = 19
button_mode_in = 26

GPIO.setmode(GPIO.BCM)
#GPIO.setup(led_power, GPIO.OUT, initial=GPIO.HIGH)
#GPIO.setup(led_working, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(button_select_in, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(button_mode_in, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

#********************* Init global variables
with open('config.json') as json_data_file:
    config = json.load(json_data_file)['server']

ready_to_shutdown = False
current_mode = 0
automatic_mode = True

_timerCheck = TimerCheck()
Beispiel #4
0
from datetime import timedelta
import time
import os
import json
from weather import Weather
from testled import TestLed
from sensor import Sensor
from timer_check import TimerCheck

#********************* Init GPIO
#led_working = 19
#led_power = 22
button_select_in = 19
button_mode_in = 26

GPIO.setmode(GPIO.BCM)
#GPIO.setup(led_power, GPIO.OUT, initial=GPIO.HIGH)
#GPIO.setup(led_working, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(button_select_in, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(button_mode_in, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

#********************* Init global variables
with open('config.json') as json_data_file:
	config = json.load(json_data_file)['server']

ready_to_shutdown = False
current_mode = 0
automatic_mode = True

_timerCheck = TimerCheck()