コード例 #1
0
def setup():
    ADC0834.setup()
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(ledPin, GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(buzzPin, GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(Joy_BtnPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    LCD1602.init(0x27, 1)
コード例 #2
0
def config():
    GPIO.setmode(GPIO.BCM)
    ADC0834.setup()

    # setup_light()

    therm.setup_files(number_of_lines)
    weather.setup_files(number_of_lines)
def setup():
    global led_val
    # Set the GPIO modes to BCM Numbering
    GPIO.setmode(GPIO.BCM)
    # Set all LedPin's mode to output and initial level to High(3.3v)
    GPIO.setup(LedPin, GPIO.OUT, initial=GPIO.HIGH)
    ADC0834.setup()
    # Set led as pwm channel and frequece to 2KHz
    led_val = GPIO.PWM(LedPin, 2000)
    # Set all begin with value 0
    led_val.start(0)
コード例 #4
0
def setup():
    global p_M1, p_M2
    ADC0834.setup()
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(MotorPin1, GPIO.OUT)
    GPIO.setup(MotorPin2, GPIO.OUT)
    p_M1 = GPIO.PWM(MotorPin1, 2000)
    p_M2 = GPIO.PWM(MotorPin2, 2000)
    p_M1.start(0)
    p_M2.start(0)
    GPIO.setup(MotorEnable, GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(BtnPin, GPIO.IN)
コード例 #5
0
def setupInput():
    GPIO.setup(button, GPIO.IN)
    ADC0834.setup()
コード例 #6
0
def init():
	ADC0834.setup()
コード例 #7
0
def setup():
    # Set the GPIO modes to BCM Numbering
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(BtnPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    ADC0834.setup()
コード例 #8
0
# Put your device token here. To get the token,
# sign up at https://cloud4rpi.io and create a device.
DEVICE_TOKEN = 'M1vyY81aq3TQLbnFuepUFhA5'

# Constants
RELAY_PIN = 20

# Change these values depending on your requirements.
DATA_SENDING_INTERVAL = 60  # secs
DIAG_SENDING_INTERVAL = 650  # secs
POLL_INTERVAL = 0.5  # 500 ms

# Configure GPIO library
GPIO.setmode(GPIO.BCM)
GPIO.setup(RELAY_PIN, GPIO.OUT)
ADC0834.setup()
move = motor(13, 19, 26)


# Handler for the button or switch variable
def relay_control(value=None):
    GPIO.output(RELAY_PIN, value)
    return GPIO.input(RELAY_PIN)


def getValue():
    analogVal = ADC0834.getResult()
    if analogVal > 100:
        move.clockwise()
        sleep(5)
        move.stop()
def setup():
    GPIO.setmode(GPIO.BCM)
    ADC0834.setup()
    for i in ledPins:
        GPIO.setup(i, GPIO.OUT)
        GPIO.output(i, GPIO.HIGH)