Python RPi.GPIO 模块,LOW 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用RPi.GPIO.LOW

项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def reverse(t=wheel_pulse/2):

    gpio.output(reverse_left, gpio.HIGH)
    gpio.output(reverse_right, gpio.HIGH)

    sleep(t)
    gpio.output(reverse_left, gpio.LOW)
    gpio.output(reverse_right, gpio.LOW)





##########################################################################
# cleanup
##########################################################################
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def reverse_left(t):
    gpio.output(15, gpio.HIGH)
    gpio.output(36, gpio.HIGH)

    sleep(t)
    gpio.output(15, gpio.LOW)
    gpio.output(36, gpio.LOW)












# test
项目:Rpi-envMonitor    作者:conanwhf    | 项目源码 | 文件源码
def _GPIO_Power_Set(pins, on):
    if on==1:
        GPIO.output( pins, GPIO.HIGH)
    else :
        GPIO.output( pins, GPIO.LOW )
    return

#=====================================
项目:EduKit1    作者:CamJam-EduKit    | 项目源码 | 文件源码
def startwalking():
    # Make the buzzer buzz on and off, half a second of
    # sound followed by half a second of silence
    # GPIO.output(PinRedPedestrian, GPIO.LOW)
    # GPIO.output(PinGreenPedestrian, GPIO.HIGH)
    iCount = 1
    while iCount <= 4:
        GPIO.output(PinBuzzer, GPIO.HIGH)
        time.sleep(0.5)
        GPIO.output(PinBuzzer, GPIO.LOW)
        time.sleep(0.5)
        iCount += 1


# Turn the buzzer off and wait for 2 seconds
# (If you have a second green 'pedestrian' LED, make it flash on and
# off for the two seconds)
项目:EduKit1    作者:CamJam-EduKit    | 项目源码 | 文件源码
def flashingambergreen():
    # Remember all code in the function is indented
    GPIO.output(PinRed, GPIO.LOW)

    iCount = 1
    while iCount <= 6:
        GPIO.output(PinAmber, GPIO.HIGH)
        # GPIO.output(PinGreenPedestrian, GPIO.HIGH)
        time.sleep(0.5)
        GPIO.output(PinAmber, GPIO.LOW)
        # GPIO.output(PinGreenPedestrian, GPIO.LOW)
        time.sleep(0.5)
        iCount += 1


# Flash the amber for one more second
# (Turn the green 'pedestrian' LED off and the red on)
项目:waterflowers    作者:chaodalong    | 项目源码 | 文件源码
def send_gpio_order(param):
    """
    GPIO????
    type in(GPIO.IN) out(GPIO.OUT)
    value 1 GPIO.HIGH 0 GPIO.LOW
    :param param:
    :return:
    """
    print param
    channel, type, value = param
    try:
        import RPi.GPIO as GPIO
    except RuntimeError:
        print("????")
    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BOARD)

    if type == 'in':
        GPIO.setup(channel, GPIO.IN)
        GPIO.input(channel, value)
    else:
        GPIO.setup(channel, GPIO.OUT)
        GPIO.output(channel, value)
项目:BH1750    作者:ElJulio    | 项目源码 | 文件源码
def Start(self):
        #SCL
        #  ______
        #  |     |______
        #SDA
        #  ___
        #  |  |_________

        GPIO.setup(self.SDA, GPIO.OUT) #cnfigure SDA as output

        GPIO.output(self.SDA, GPIO.HIGH)
        GPIO.output(self.SCL, GPIO.HIGH)
        self.tick(1)
        GPIO.output(self.SDA, GPIO.LOW)
        self.tick(1)
        GPIO.output(self.SCL, GPIO.LOW)
        self.tick(2)
项目:BH1750    作者:ElJulio    | 项目源码 | 文件源码
def ReadAck(self):
        GPIO.setup(self.SDA, GPIO.IN)
        readbuffer =0
        for i in range(8):
            GPIO.output(self.SCL, GPIO.HIGH)
            self.tick(2)
            readbuffer |= (GPIO.input(self.SDA)<< 7) >> i
            GPIO.output(self.SCL, GPIO.LOW)
            self.tick(2)

        GPIO.setup(self.SDA, GPIO.OUT)
        GPIO.output(self.SDA, GPIO.LOW)
        GPIO.output(self.SCL, GPIO.HIGH)
        self.tick(2)
        GPIO.output(self.SCL, GPIO.LOW)
        GPIO.output(self.SDA, GPIO.LOW)
        self.tick(2)
        return readbuffer
项目:BH1750    作者:ElJulio    | 项目源码 | 文件源码
def ReadNack(self):
        GPIO.setup(self.SDA, GPIO.IN)
        readbuffer =0
        for i in range(8):
            GPIO.output(self.SCL, GPIO.HIGH)
            self.tick(2)
            readbuffer |= (GPIO.input(self.SDA)<< 7) >> i
            GPIO.output(self.SCL, GPIO.LOW)
            self.tick(2)

        GPIO.setup(self.SDA, GPIO.OUT)
        GPIO.output(self.SDA, GPIO.HIGH)
        GPIO.output(self.SCL, GPIO.HIGH)
        self.tick(2)
        GPIO.output(self.SCL, GPIO.LOW)
        GPIO.output(self.SDA, GPIO.LOW)
        self.tick(2)
        return readbuffer
项目:burro    作者:yconst    | 项目源码 | 文件源码
def __init__(self, channel, invert=False):
        from navio import adafruit_pwm_servo_driver as pwm
        from navio import util
        import RPi.GPIO as GPIO
        util.check_apm()

        #Navio+ requires the GPIO line 27 to be set to low 
        #before the PCA9685 is accesed 
        GPIO.setwarnings(False)
        GPIO.setmode(GPIO.BCM)
        GPIO.setup(27, GPIO.OUT)
        GPIO.output(27,GPIO.LOW)

        #GPIO.cleanup()
        self.frequency = 60
        self.channel = channel
        self.invert = invert
        self.pwm = pwm.PWM()
        self.pwm.setPWMFreq(self.frequency)
项目:red-phone    作者:mixmasteru    | 项目源码 | 文件源码
def __init__(self, ready):
        Thread.__init__(self)
        self.ready = ready
        self.picked_up = False
        self.on = True
        self._ringer1 = 11
        self._ringer2 = 13
        self._button = 7

        GPIO.setmode(GPIO.BOARD)
        GPIO.setwarnings(False)
        GPIO.setup(self._ringer1, GPIO.OUT)
        GPIO.output(self._ringer1, GPIO.LOW)
        GPIO.setup(self._ringer2, GPIO.OUT)
        GPIO.output(self._ringer2, GPIO.LOW)
        GPIO.setup(self._button, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

        self._last_state = 0
        self._last_ts = time.time()
        self._last_check = time.time()
        self._ring = 1
        self.max_ring_cnt = 2
项目:raspberrypinixie    作者:sroaj    | 项目源码 | 文件源码
def _pin_pulse(pin, initial_state=GPIO.LOW, pulse_width=PULSE_WIDTH_SEC):
    # type: (int, bool, Union[int, float]) -> None
    """Sends one pulse to the specified pin.

    The pin will be returned to the specified initial state after the pulse

    Args:
        pin: The pin to pulse.
        initial_state: The negation of this will be used as the pulse.
            Defaults to GPIO.LOW.
        pulse_width: how long, in seconds, to pulse the pin.
            Defaults to PULSE_WIDTH_SEC.
    """
    GPIO.output(pin, not initial_state)
    try:
        time.sleep(pulse_width)
    finally:
        GPIO.output(pin, initial_state)
项目:craftbeerpi3    作者:Manuel83    | 项目源码 | 文件源码
def beep(self):
        if self.state is False:
            cbpi.app.logger.error("BUZZER not working")
            return

        def play(sound):
            try:
                for i in sound:
                    if (isinstance(i, str)):
                        if i == "H" and self.beep_level == "HIGH":
                            GPIO.output(int(self.gpio), GPIO.HIGH)
                        elif i == "H" and self.beep_level != "HIGH":
                            GPIO.output(int(self.gpio), GPIO.LOW)
                        elif i == "L" and self.beep_level == "HIGH":
                            GPIO.output(int(self.gpio), GPIO.LOW)
                        else:
                            GPIO.output(int(self.gpio), GPIO.HIGH)
                    else:
                        time.sleep(i)
            except Exception as e:
                pass

        start_new_thread(play, (self.sound,))
项目:Gartenwasser    作者:bgewehr    | 项目源码 | 文件源码
def on_message(mosq, obj, msg):
    """
    Handle incoming messages
    """
    if msg.topic == MONITOR_REFRESH:
        refresh()
        return

    topicparts = msg.topic.split("/")
    pin = int(topicparts[len(topicparts) - 1])
    try:
        value = int(float(msg.payload))
    except ValueError:
        value = 0

    if pin not in GPIO_OUTPUT_PINS:
        GPIO.setup(pin, GPIO.OUT, initial=GPIO.HIGH)
        GPIO_OUTPUT_PINS.append(pin)
    if topicparts[2] == 'in':
        if value == 1:
            GPIO.output(pin, GPIO.LOW)
        else:
            GPIO.output(pin, GPIO.HIGH)

# End of MQTT callbacks
项目:pimaa    作者:outboxafrica    | 项目源码 | 文件源码
def read(self):
        '''Reads 32 bits of the SPI bus & stores as an integer in self.data.'''
        bytesin = 0
        # Select the chip
        GPIO.output(self.cs_pin, GPIO.LOW)
        # Read in 32 bits
        for i in range(32):
            GPIO.output(self.clock_pin, GPIO.LOW)
            bytesin = bytesin << 1
            if (GPIO.input(self.data_pin)):
                bytesin = bytesin | 1
            GPIO.output(self.clock_pin, GPIO.HIGH)
        # Unselect the chip
        GPIO.output(self.cs_pin, GPIO.HIGH)
        # Save data
        self.data = bytesin
项目:pimaa    作者:outboxafrica    | 项目源码 | 文件源码
def read(self):
        '''Reads 16 bits of the SPI bus & stores as an integer in self.data.'''
        bytesin = 0
        # Select the chip
        GPIO.output(self.cs_pin, GPIO.LOW)
        # Read in 16 bits
        for i in range(16):
            GPIO.output(self.clock_pin, GPIO.LOW)
            time.sleep(0.001)
            bytesin = bytesin << 1
            if (GPIO.input(self.data_pin)):
                bytesin = bytesin | 1
            GPIO.output(self.clock_pin, GPIO.HIGH)
        time.sleep(0.001)
        # Unselect the chip
        GPIO.output(self.cs_pin, GPIO.HIGH)
        # Save data
        self.data = bytesin
项目:kalliope    作者:kalliope-project    | 项目源码 | 文件源码
def init_gpio(self, rpi_settings):
        """
        Initialize GPIO pin to a default value. Leds are off by default
        Mute button is set as an input
        :param rpi_settings: RpiSettings object
        """
        # All led are off by default
        if self.rpi_settings.pin_led_muted:
            GPIO.setup(rpi_settings.pin_led_muted, GPIO.OUT, initial=GPIO.LOW)
        if self.rpi_settings.pin_led_started:
            GPIO.setup(rpi_settings.pin_led_started, GPIO.OUT, initial=GPIO.LOW)
        if self.rpi_settings.pin_led_listening:
            GPIO.setup(rpi_settings.pin_led_listening, GPIO.OUT, initial=GPIO.LOW)
        if self.rpi_settings.pin_led_talking:
            GPIO.setup(rpi_settings.pin_led_talking, GPIO.OUT, initial=GPIO.LOW)

        # MUTE button
        if self.rpi_settings.pin_mute_button:
            GPIO.setup(rpi_settings.pin_mute_button, GPIO.IN, pull_up_down=GPIO.PUD_UP)
            GPIO.add_event_detect(rpi_settings.pin_mute_button, GPIO.FALLING,
                                  callback=self.switch_kalliope_mute_led,
                                  bouncetime=500)
项目:rpi.rtc    作者:sourceperl    | 项目源码 | 文件源码
def __init__(self, clk_pin=11, data_pin=13, ce_pin=15):
        # init GPIO
        # no warnings
        GPIO.setwarnings(False)
        # use safer pin number (avoid GPIO renumber on each Pi release)
        GPIO.setmode(GPIO.BOARD)
        # set GPIO pins
        self._clk_pin = clk_pin
        self._data_pin = data_pin
        self._ce_pin = ce_pin
        # CLK and CE (sometime call RST) pin are always output
        GPIO.setup(self._clk_pin, GPIO.OUT, initial=GPIO.LOW)
        GPIO.setup(self._ce_pin, GPIO.OUT, initial=GPIO.LOW)
        # turn off WP (write protect)
        self._start_tx()
        self._w_byte(0x8e)
        self._w_byte(0x00)
        self._end_tx()
        # charge mode is disabled
        self._start_tx()
        self._w_byte(0x90)
        self._w_byte(0x00)
        self._end_tx()
项目:rpi.rtc    作者:sourceperl    | 项目源码 | 文件源码
def _r_byte(self):
        """
        Read byte from the chip.

        :return: byte value
        :rtype: int
        """
        # data pin is now input (pull-down resistor embedded in chip)
        GPIO.setup(self._data_pin, GPIO.IN)
        # clock the byte from chip
        byte = 0
        for i in range(8):
            # make a high pulse on CLK pin
            GPIO.output(self._clk_pin, GPIO.HIGH)
            time.sleep(self.CLK_DELAY)
            GPIO.output(self._clk_pin, GPIO.LOW)
            time.sleep(self.CLK_DELAY)
            # chip out data on clk falling edge: store current bit into byte
            bit = GPIO.input(self._data_pin)
            byte |= ((2 ** i) * bit)
        # return byte value
        return byte
项目:rpi.rtc    作者:sourceperl    | 项目源码 | 文件源码
def _w_byte(self, byte):
        """
        Write byte to the chip.

        :param byte: byte value
        :type byte: int
        """
        # data pin is now output
        GPIO.setup(self._data_pin, GPIO.OUT)
        # clock the byte to chip
        for _ in range(8):
            GPIO.output(self._clk_pin, GPIO.LOW)
            time.sleep(self.CLK_DELAY)
            # chip read data on clk rising edge
            GPIO.output(self._data_pin, byte & 0x01)
            byte >>= 1
            GPIO.output(self._clk_pin, GPIO.HIGH)
            time.sleep(self.CLK_DELAY)
项目:aws-iot-python    作者:vjammar    | 项目源码 | 文件源码
def stopwatch(hexUID, name):
    start = time.time()
    time.clock()
    elapsed = 0
    while elapsed < maxRaceTime and GPIO.input(laserPin) != GPIO.LOW:
        elapsed = time.time() - start
        millis = int(round(elapsed * 1000))
        hours, millis = divmod(millis, 3600000)
        minutes, millis = divmod(millis, 60000)
        seconds, millis = divmod(millis, 1000)
        s = "%02i:%02i:%03i" % (minutes, seconds, millis)
        with canvas(disp) as draw:
                draw.text((0, 0), "Timer:", font=defaultFont, fill=255)
                draw.text((0, 20), s, font=timerFont, fill=255)
    color(100, 0, 0, 0)
    publishRaceTimes(hexUID, name, elapsed)

# Function to plubish the race times for the current user.
# It takes the hexUID, name and completionTime
# and publishes them to the AWS IoT topic.
项目:tinyjaguar    作者:calston    | 项目源码 | 文件源码
def powerGood(self, state):
        if state == gpio.LOW:
            self.atxGood = True
            print "ATX Good"
            yield self.sr.shiftOut(reduce(lambda x, y: x | y, self.green))
            yield utils.wait(200)
            yield self.sr.shiftOut(0)
            yield utils.wait(100)
            yield self.sr.shiftOut(reduce(lambda x, y: x | y, self.green))
            yield utils.wait(200)
            yield self.setLEDStates()

            # Start node 1
            if self.autoOn:
                self.autoOn = False
                yield self.nodeOn(0)
        else:
            print "ATX bad"
            self.atxGood = False
项目:tinyjaguar    作者:calston    | 项目源码 | 文件源码
def greenButton(self, state):
        if state == gpio.LOW:
            o = reduce(lambda x, y: x | y, self.green)
            yield self.sr.shiftOut(o)
            self.autoOn = True

        else:
            # Button released
            yield self.setLEDStates()

            if self.states[0] == 2:
                self.autoOn = False
                # Node 1 is active, so start all the others
                for i in range(4):
                    yield self.nodeOn(i)
                    if i < 3:
                        yield utils.wait(1000)
            else:
                self.atxOn.on()
项目:pipypd    作者:stressfm    | 项目源码 | 文件源码
def RCtime (PiPin):
    measurement = 0
    # Discharge capacitor
    GPIO.setup(PiPin, GPIO.OUT)
    GPIO.output(PiPin, GPIO.LOW)
    time.sleep(0.1)

    GPIO.setup(PiPin, GPIO.IN)
    # Count loops until voltage across
    # capacitor reads high on GPIO
    start = time.time()
    while (GPIO.input(PiPin) == GPIO.LOW):
        measurement += 1

    end = time.time()
    # print end - start
    # return measurement
    return str(end - start)

# Connects the socket
项目:pipypd    作者:stressfm    | 项目源码 | 文件源码
def RCtime (PiPin):
    measurement = 0
    # Discharge capacitor
    GPIO.setup(PiPin, GPIO.OUT)
    GPIO.output(PiPin, GPIO.LOW)
    time.sleep(0.1)

    GPIO.setup(PiPin, GPIO.IN)
    # Count loops until voltage across
    # capacitor reads high on GPIO
    start = time.time()
    while (GPIO.input(PiPin) == GPIO.LOW):
        measurement += 1

    end = time.time()
    # print end - start
    # return measurement
    return str(end - start)

# Main program loop
项目:infilcheck    作者:jonnykry    | 项目源码 | 文件源码
def light_sense():

    count = 0

    #Output on the pin for 
    GPIO.setup(pin_to_circuit, GPIO.OUT)
    GPIO.output(pin_to_circuit, GPIO.LOW)
    time.sleep(0.1)

    #Change the pin back to input
    GPIO.setup(pin_to_circuit, GPIO.IN)

    #Count until the pin goes high
    while (GPIO.input(pin_to_circuit) == GPIO.LOW):
        count += 1

    if (count > 3000):
        led5_on()
        return count
    else:
        led5_off()
        return count
项目:raspi-photo-booth    作者:kriskbx    | 项目源码 | 文件源码
def beepOn():
    global DisableBeep
    if DisableBeep == False:
        GPIO.output(BeepPin, GPIO.LOW)
项目:raspi-photo-booth    作者:kriskbx    | 项目源码 | 文件源码
def ledOn():
    GPIO.output(LedPin, GPIO.LOW)
项目:StratoBalloon    作者:delattreb    | 项目源码 | 文件源码
def __init__(self, name = ''):
        self.importlib = GPIO
        self.logger = com_logger.Logger(name)
        # self.setwarnings(False)
        self.IN = GPIO.IN if GPIO is not None else None
        self.OUT = GPIO.OUT if GPIO is not None else None
        self.LOW = GPIO.LOW if GPIO is not None else None
        self.HIGH = GPIO.HIGH if GPIO is not None else None
        self.PUD_UP = GPIO.PUD_UP if GPIO is not None else None
        self.PUD_DOWN = GPIO.PUD_DOWN if GPIO is not None else None
        self.RISING = GPIO.RISING if GPIO is not None else None
项目:voctomix-outcasts    作者:CarlFK    | 项目源码 | 文件源码
def enable_tally(self, enable):
        if enable:
            GPIO.output(self.gpio_red, GPIO.LOW)
        else:
            GPIO.output(self.gpio_red, GPIO.HIGH)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
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)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def turn_left(t=wheel_pulse):
    gpio.output(forward_right, gpio.HIGH)

    sleep(t)
    gpio.output(forward_right, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def turn_right(t=wheel_pulse):
    gpio.output(forward_left, gpio.HIGH)

    sleep(t)
    gpio.output(forward_left, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def reverse(t=wheel_pulse):

    gpio.output(reverse_left, gpio.HIGH)
    gpio.output(reverse_right, gpio.HIGH)

    sleep(t)
    gpio.output(reverse_left, gpio.LOW)
    gpio.output(reverse_right, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def hard_right(t=wheel_pulse):
    gpio.output(forward_left, gpio.HIGH)
    gpio.output(reverse_right, gpio.HIGH)

    sleep(t)
    gpio.output(forward_left, gpio.LOW)
    gpio.output(reverse_right, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
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)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def forward(self):

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

        sleep(self.wheel_pulse)
        gpio.output(self.forward_right, gpio.LOW)
        gpio.output(self.forward_left, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def reverse(self):

        gpio.output(self.reverse_left, gpio.HIGH)
        gpio.output(self.reverse_right, gpio.HIGH)

        sleep(self.wheel_pulse)
        gpio.output(self.reverse_left, gpio.LOW)
        gpio.output(self.reverse_right, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def hard_right(self):

        gpio.output(self.forward_left, gpio.HIGH)
        gpio.output(self.reverse_right, gpio.HIGH)

        sleep(self.wheel_pulse)
        gpio.output(self.forward_left, gpio.LOW)
        gpio.output(self.reverse_right, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def go_forward(t):

    print('forward')

    gpio.output(right_forward, gpio.HIGH)
    gpio.output(left_forward, gpio.HIGH)

    sleep(t)
    gpio.output(right_forward, gpio.LOW)
    gpio.output(left_forward, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def turn_left(t):

    print('left')
    gpio.output(right_forward, gpio.HIGH)

    sleep(t)
    gpio.output(right_forward, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def turn_right(t):
    print('right')
    gpio.output(left_forward, gpio.HIGH)

    sleep(t)
    gpio.output(left_forward, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def go_backward(t):

    print('reverse')

    gpio.output(right_reverse, gpio.HIGH)
    gpio.output(left_reverse, gpio.HIGH)

    sleep(t)
    gpio.output(right_reverse, gpio.LOW)
    gpio.output(left_reverse, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def reverse_turn_left(t):
    print('reverse left')
    gpio.output(left_reverse, gpio.HIGH)

    sleep(t)
    gpio.output(left_reverse, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def hard_right(t=1.):
    print('hard right')
    gpio.output(left_forward, gpio.HIGH)
    gpio.output(right_reverse, gpio.HIGH)

    sleep(t)
    gpio.output(left_forward, gpio.LOW)
    gpio.output(right_reverse, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def hard_left(t=1.):
    print('hard left')
    gpio.output(right_forward, gpio.HIGH)
    gpio.output(left_reverse, gpio.HIGH)

    sleep(t)
    gpio.output(right_forward, gpio.LOW)
    gpio.output(left_reverse, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def stop1(t=1):
    print('stop1')
    gpio.output(left_forward, gpio.HIGH)
    gpio.output(left_reverse, gpio.HIGH)

    sleep(t)
    gpio.output(left_forward, gpio.LOW)
    gpio.output(left_reverse, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def stop2(t=1):
    print('stop2')
    gpio.output(right_forward, gpio.HIGH)
    gpio.output(right_reverse, gpio.HIGH)

    sleep(t)
    gpio.output(right_forward, gpio.LOW)
    gpio.output(right_reverse, gpio.LOW)



# test
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def forward_rear(t):

    gpio.output(13, gpio.HIGH)
    gpio.output(31, gpio.HIGH)

    sleep(t)
    gpio.output(13, gpio.LOW)
    gpio.output(31, gpio.LOW)
项目:RaspberryPi-Robot    作者:timestocome    | 项目源码 | 文件源码
def forward_right(t):
    gpio.output(40, gpio.HIGH)
    gpio.output(31, gpio.HIGH)

    sleep(t)
    gpio.output(40, gpio.LOW)
    gpio.output(31, gpio.LOW)