“Importuj GPIO Raspberry Pi” Kod odpowiedzi

GPIO konfiguracji RASPI

import RPi.GPIO as GPIO            # import RPi.GPIO module  
from time import sleep             # lets us have a delay  
GPIO.setmode(GPIO.BCM)             # choose BCM or BOARD  
GPIO.setup(24, GPIO.OUT)           # set GPIO24 as an output   

try:  
  while True:  
    GPIO.output(24, 1)         # set GPIO24 to 1/GPIO.HIGH/True  
    sleep(0.5)                 # wait half a second  
    GPIO.output(24, 0)         # set GPIO24 to 0/GPIO.LOW/False  
    sleep(0.5)                 # wait half a second  

    except KeyboardInterrupt:          # trap a CTRL+C keyboard interrupt  
      GPIO.cleanup()                 # resets all GPIO ports used by this program  
Flyhouse_Squarewheel

Importuj GPIO Raspberry Pi

# The RPi.GPIO module is installed by default on recent versions of Raspbian Linux. To use the module from Python programs, first import it using:

import RPi.GPIO as GPIO

# This way you can refer to all functions in the module using the shorter name "GPIO".
CoderHomie

Odpowiedzi podobne do “Importuj GPIO Raspberry Pi”

Pytania podobne do “Importuj GPIO Raspberry Pi”

Więcej pokrewnych odpowiedzi na “Importuj GPIO Raspberry Pi” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu