Skip to content

Instantly share code, notes, and snippets.

View getelectronics's full-sized avatar

getelectronics

View GitHub Profile
# Needed modules will be imported and configured
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# The input pin which is connected with the sensor
GPIO_PIN = 21
GPIO.setup(GPIO_PIN, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
#The output pin
GPIO_PIN = 21
GPIO.setup(GPIO_PIN, GPIO.OUT)
pwm = GPIO.PWM(GPIO_PIN, 500)
pwm.start(50)
# The program will wait for the input of a new frequency.
# Needed modules will be imported and configured
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# The input pin which is connected with the sensor
GPIO_PIN = 21
GPIO.setup(GPIO_PIN, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
import random, time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
# Declaration of output pins
LED_RED = 20
LED_GREEN = 21
# Set pins to output mode
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# The output pins will be declared, which are connected with the LEDs.
LED_RED = 20
LED_GREEN = 21
GPIO.setup(LED_RED, GPIO.OUT, initial= GPIO.LOW)
GPIO.setup(LED_GREEN, GPIO.OUT, initial= GPIO.LOW)
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
sensor = 17
led = 27
GPIO.setup(sensor, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(led, GPIO.OUT)
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
sensor = 17
led = 27
GPIO.setup(sensor, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(led, GPIO.OUT)
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
sensor = 17
led = 27
GPIO.setup(sensor, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(led, GPIO.OUT)
# needed modules will be imported
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
# The input pin of the Sensor will be declared. Additional to that the pullup resistor will be activated.
GPIO_PIN = 27
GPIO.setup(GPIO_PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP)