python类output()的实例源码

jenkinslight.py 文件源码 项目:rpi-jenkins-tower-light 作者: BramDriesen 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def toggle(gpio, duration):
    GPIO.output(gpio, True)
    time.sleep(duration)
    GPIO.output(gpio, False)
    time.sleep(duration)
    return


# Set according to status
jenkinslight.py 文件源码 项目:rpi-jenkins-tower-light 作者: BramDriesen 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def setstatus(status):
    if status != "":
        alloff()
        if status == "SUCCESS":
            GPIO.output(getcode('green'), True)

        if status == "UNSTABLE":
            GPIO.output(getcode('yellow'), True)

        if status == "FAILURE":
            GPIO.output(getcode('red'), True)
    return
main.py 文件源码 项目:rpi-can-logger 作者: JonnoFTW 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def led1(on_off):
    GPIO.output(7, bool(on_off))
main.py 文件源码 项目:rpi-can-logger 作者: JonnoFTW 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def led2(on_off):
    GPIO.output(37, bool(on_off))
gpio_led_test.py 文件源码 项目:rpi-can-logger 作者: JonnoFTW 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def led1(on_off):
    GPIO.output(7, bool(on_off))
gpio_led_test.py 文件源码 项目:rpi-can-logger 作者: JonnoFTW 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def led2(on_off):
    GPIO.output(37, bool(on_off))
controller.py 文件源码 项目:cooktop-IoT 作者: gabimachado 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def switchOnLight(PIN):
    GPIO.setup(PIN, GPIO.OUT)
    GPIO.output(PIN, True)
controller.py 文件源码 项目:cooktop-IoT 作者: gabimachado 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def switchOffLight(PIN):
    GPIO.setup(PIN, GPIO.OUT)
    GPIO.output(PIN, False)
PhotoBooth.py 文件源码 项目:raspi-photo-booth 作者: kriskbx 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def beepOn():
    global DisableBeep
    if DisableBeep == False:
        GPIO.output(BeepPin, GPIO.LOW)
PhotoBooth.py 文件源码 项目:raspi-photo-booth 作者: kriskbx 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def beepOff():
    GPIO.output(BeepPin, GPIO.HIGH)
PhotoBooth.py 文件源码 项目:raspi-photo-booth 作者: kriskbx 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def ledOn():
    GPIO.output(LedPin, GPIO.LOW)
PhotoBooth.py 文件源码 项目:raspi-photo-booth 作者: kriskbx 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def ledOff():
    GPIO.output(LedPin, GPIO.HIGH)

# Event Listener
backend.py 文件源码 项目:WebGPIO 作者: ThisIsQasim 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def setstate(roomNumber, accNumber, state):
    if len(outPin[roomNumber]) != 0:
        GPIO.output(outPin[roomNumber][accNumber], 1 - state)
    #subprocess.call(['./echo.sh'], shell=True)
    else:
        #action for other rooms
        subprocess.call(['./echo.sh'], shell=True)
    return "0"
backend.py 文件源码 项目:WebGPIO 作者: ThisIsQasim 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def toggle(roomNumber, accNumber):
    if len(outPin[roomNumber]) != 0:
        state= 1 - GPIO.input(outPin[roomNumber][accNumber])
        GPIO.output(outPin[roomNumber][accNumber], state)
        #subprocess.call(['./echo.sh'], shell=True)
    else:
        #action for other rooms
        subprocess.call(['./echo.sh'], shell=True)
    #print(roomNumber, accNumber)
    buttonHtmlName = accName[roomNumber][accNumber].replace(" ", "<br>")
    passer="<button class='%s' onclick='toggle(%d,%d)'>%s</button>" % (accState(roomNumber,accNumber), roomNumber, accNumber, buttonHtmlName)
    return passer
com_gpio.py 文件源码 项目:StratoBalloon 作者: delattreb 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def setio(self, io_number, state):
        if self.importlib is not None:
            GPIO.output(io_number, state)
com_gpio.py 文件源码 项目:StratoBalloon 作者: delattreb 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def switchio(self, io_number):
        if self.importlib is not None:
            GPIO.output(io_number, not self.getio(io_number))
voctolight.py 文件源码 项目:voctomix-outcasts 作者: CarlFK 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def reset_led(self):
        GPIO.setmode(GPIO.BOARD)
        GPIO.setwarnings(False)
        for gpio in self.gpios:
            gpio = int(gpio)
            GPIO.setup(gpio, GPIO.OUT)
            GPIO.output(gpio, GPIO.HIGH)
voctolight.py 文件源码 项目:voctomix-outcasts 作者: CarlFK 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def enable_tally(self, enable):
        if enable:
            GPIO.output(self.gpio_red, GPIO.LOW)
        else:
            GPIO.output(self.gpio_red, GPIO.HIGH)
ObstacleRL.py 文件源码 项目:RaspberryPi-Robot 作者: timestocome 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def get_state(sleep_time=wheel_pulse):

    # clear trigger sensor
    gpio.output(trigger, False)
    time.sleep(sleep_time)

    # send trigger pulse
    gpio.output(trigger, True)
    time.sleep(0.00001)
    gpio.output(trigger, False)

    while gpio.input(echo) == 0:
        pulse_start = time.time()

    while gpio.input(echo) == 1:
        pulse_end = time.time()


    pulse_duration = pulse_end - pulse_start
    distance = pulse_duration * 343 * 100 / 2.  # speed of sound m/s * m to cm / round trip

    if distance > 2 and distance < 400:         # sensor range
        distance = distance + distance_from_sensor_to_car_front

    # don't worry about things further 4'
    # this also reduces the size of the state machine
    if distance >= max_distance:    
        distance = max_distance - 1

    return int(distance)





##############################################################################
# perform action
##############################################################################
ObstacleRL.py 文件源码 项目:RaspberryPi-Robot 作者: timestocome 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def forward(t=wheel_pulse):

    gpio.output(forward_right, gpio.HIGH)
    gpio.output(forward_left, gpio.HIGH)

    sleep(t)
    gpio.output(forward_right, gpio.LOW)
    gpio.output(forward_left, gpio.LOW)


问题


面经


文章

微信
公众号

扫码关注公众号