Code in echten Code konvertiert
This commit is contained in:
1 parent
b93d6f65fa
commit
f72538fc63
2 files changed
+30
-15
No files matched your search
+14
-8
@@ -1,8 +1,10 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python2
|
||||||
import RPi.GPIO as GPIO
|
#-*- coding:utf-8 -*-
|
||||||
import time
|
|
||||||
|
|
||||||
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_23=22
|
||||||
GPIO_17=32
|
GPIO_17=32
|
||||||
@@ -13,16 +15,20 @@ GPIO_2=3
|
|||||||
GPIO_3=5
|
GPIO_3=5
|
||||||
|
|
||||||
def gpio_on (theGPIO):
|
def gpio_on (theGPIO):
|
||||||
# param1=INT # gpio#Nr
|
# param1=INT # gpio#Nr
|
||||||
GPIO.setup(theGPIO, GPIO.OUT)
|
GPIO.setup(theGPIO, GPIO.OUT)
|
||||||
GPIO.output(theGPIO,True) # lamp on
|
# 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):
|
def gpio_off (theGPIO):
|
||||||
# param1=INT # gpio#Nr
|
# param1=INT # gpio#Nr
|
||||||
GPIO.setup(theGPIO, GPIO.OUT)
|
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):
|
def gpio_on_for (theGPIO, miliSec):
|
||||||
gpio_on (theGPIO)
|
gpio_on (theGPIO)
|
||||||
sleep miliSec
|
sleep (miliSec)
|
||||||
gpio_off (theGPIO)
|
gpio_off (theGPIO)
|
||||||
+16
-7
@@ -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
|
linkeFlasche=GPIO_17
|
||||||
rechteFlasche=GPIO_27
|
rechteFlasche=GPIO_27
|
||||||
|
|
||||||
# Rezept für Apfelsaft
|
# Rezept für Apfelsaft
|
||||||
gpio_on linkeFlasche
|
gpio_on (linkeFlasche)
|
||||||
sleep 0.5
|
sleep (0.5)
|
||||||
gpio_off linkeFlasche
|
gpio_off (linkeFlasche)
|
||||||
|
|
||||||
gpio_on rechteFlasche
|
gpio_on (rechteFlasche)
|
||||||
sleep 1.5
|
sleep (1.5)
|
||||||
gpio_off rechteFlasche
|
gpio_off (rechteFlasche)
|
||||||
|
|
||||||
|
# oder in einer Funktion
|
||||||
|
#gpio_on_for (linkeFlasche, 0.5)
|
||||||
|
#gpio_on_for (rechteFlasche, 1.5)
|
||||||
Reference in new issue
Block a user