Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

raspi setup gpio

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  
Comment

import 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".
Comment

PREVIOUS NEXT
Code Example
Python :: create a colun in pandas using groupby 
Python :: kaspersky 
Python :: remove timezone from a datetime object? 
Python :: python selenium driver 
Python :: add header info in django response 
Python :: python modulo 
Python :: tensorflow data augmentation 
Python :: convert sentence to list of words python 
Python :: clear 
Python :: how to run python on ios 
Python :: run ipython inside pipenv 
Python :: string slicing python 
Python :: replace nan from another column 
Python :: simple bmi calculator using python 
Python :: how to earn money as a python developer 
Python :: length of an empty array in python 
Python :: python minimum 
Python :: principal component analysis (pca) 
Python :: python in intellij 
Python :: stop for loop python 
Python :: python get the last in dictionary 
Python :: python create list 
Python :: add to list in python 
Python :: django filter values with e and operator 
Python :: python clear() 
Python :: count function in python 
Python :: how to add number in tuple 
Python :: how to use variable from another function in python 
Python :: python enum 
Python :: save python pptx in colab 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =