Files
robotik-WS-2022/inc/robot_inc.py
T
2023-01-07 00:04:14 +01:00

37 lines
741 B
Python

#!/usr/bin/env python2
#-*- coding:utf-8 -*-
import RPi.GPIO as GPIO
from time import sleep
valid_led = [32,15,31,22,3,5]
GPIO_23=22
GPIO_17=32
GPIO_18=15
GPIO_27=31
GPIO_23=22
GPIO_2=3
GPIO_3=5
GPIO.setmode(GPIO.BOARD)
def gpio_on (theGPIO):
# param1=INT # gpio#Nr
GPIO.setup(theGPIO, GPIO.OUT)
# print "GPIO.setup(" + str(theGPIO) + ", GPIO.OUT)"
GPIO.output(theGPIO,True) # lamp on
# print "GPIO.output(" + str(theGPIO) + ",True)" # lamp on
def gpio_off (theGPIO):
# param1=INT # gpio#Nr
GPIO.setup(theGPIO, GPIO.OUT)
GPIO.output(theGPIO,False) # lamp off
# 50 milliseconds = miliSec = 0.05
def gpio_on_for (theGPIO, miliSec):
gpio_on (theGPIO)
sleep (miliSec)
gpio_off (theGPIO)