works:linux:alpine-pi3:python3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
works:linux:alpine-pi3:python3 [2017/11/14 19:37]
Chugreev Eugene
works:linux:alpine-pi3:python3 [2018/12/15 17:18] (current)
Line 1: Line 1:
 ===== Alpine linux GPIO ===== ===== Alpine linux GPIO =====
 +
 +Как вывод, например лампочка:
 <code python> <code python>
 import RPi.GPIO as GPIO import RPi.GPIO as GPIO
Line 12: Line 14:
 print "LED off" print "LED off"
 GPIO.output(18,GPIO.LOW) GPIO.output(18,GPIO.LOW)
 +</code>
  
- +Как ввод, например кнопка : 
 +<code python> 
 +import RPi.GPIO as GPIO   
 +GPIO.setmode(GPIO.BCM) 
 +GPIO.setup(25, GPIO.IN) 
 +if GPIO.input(25):           # if port 25 == 1   
 +    print "pin 25 == (1 | GPIO.HIGH | True)" 
 +else:   
 +    print "pin 25 == (0 | GPIO.LOW | False)" 
 +       
 +    GPIO.cleanup()               # clean up after yourself  
 </code> </code>
- 
- 
works/linux/alpine-pi3/python3.1510688252.txt.gz · Last modified: 2018/12/15 17:17 (external edit)