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 :: defaultdict initialize keys 
Python :: code coverage pytest as html 
Python :: pysimplegui themes 
Python :: slicing in python 
Python :: discord py fetch message 
Python :: pandas series top 5 percent 
Python :: pandas write csv 
Python :: what is a class in python 
Python :: df sort by column names 
Python :: pandas datetime to unix timestamp 
Python :: count no of nan in a 2d array python 
Python :: how to load user from jwt token request django 
Python :: how to find index of maximum value in dataframe in python 
Python :: strip in split python 
Python :: len in python 
Python :: python check variable size in memory 
Python :: python includes string 
Python :: list_display django foreign key 
Python :: how to count the lines of code using open in python 
Python :: loginrequiredmixin django 
Python :: how to change value of categorical variable in python 
Python :: poppler on colab 
Python :: tkinter filedialog how to show more than one filetype 
Python :: break line in string python 
Python :: pandas change column type 
Python :: python beautifulsoup xpath 
Python :: zip a directory in python 
Python :: python os module 
Python :: exclude first value of an array python 
Python :: how to convert float to string in python 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =