Code in echten Code konvertiert

This commit is contained in:
ub committed 2023-01-06 23:57:37 +01:00
1 parent b93d6f65fa
commit f72538fc63
2 files changed
+28 -13

No files matched your search

+12 -6
View File
@@ -1,8 +1,10 @@
#!/usr/bin/env python2
import RPi.GPIO as GPIO
import time
#-*- coding:utf-8 -*-
valid_led = [32,15,31,22,3,5];
import RPi.GPIO as GPIO
from time import sleep
valid_led = [32,15,31,22,3,5]
GPIO_23=22
GPIO_17=32
@@ -15,14 +17,18 @@ GPIO_3=5
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
# param1=INT # gpio#Nr
GPIO.setup(theGPIO, GPIO.OUT)
GPIO.output(theGPIO,False) # lamp on
GPIO.output(theGPIO,False) # lamp off
# 50 milliseconds = miliSec = 0.05
def gpio_on_for (theGPIO, miliSec):
gpio_on (theGPIO)
sleep miliSec
sleep (miliSec)
gpio_off (theGPIO)
+16 -7
View File
@@ -1,13 +1,22 @@
import inc/robot-inc
#!/usr/bin/env python2
#-*- coding:utf-8 -*-
import sys
sys.path.append("inc")
from robot_inc import *
linkeFlasche=GPIO_17
rechteFlasche=GPIO_27
# Rezept für Apfelsaft
gpio_on linkeFlasche
sleep 0.5
gpio_off linkeFlasche
gpio_on (linkeFlasche)
sleep (0.5)
gpio_off (linkeFlasche)
gpio_on rechteFlasche
sleep 1.5
gpio_off rechteFlasche
gpio_on (rechteFlasche)
sleep (1.5)
gpio_off (rechteFlasche)
# oder in einer Funktion
#gpio_on_for (linkeFlasche, 0.5)
#gpio_on_for (rechteFlasche, 1.5)