This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |