Bonjour ,
Un script python depuis un terminal ssh , fait clignoter une DEL.
Quand le terminal est fermé, comment éteindre la DEL distante ?
Le script :
Svp, quelques conseils
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 import RPi.GPIO as GPIO import time import sys GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) LED = 38 ledState = False GPIO.setup(LED, GPIO.OUT) i=0 while True: try: if i==5: break else : ledState = not ledState print('1') GPIO.output(LED, ledState) time.sleep(1.5) ledState = not ledState print('0') GPIO.output(LED, ledState) time.sleep(1.5) i +=1 except : GPIO.output(LED,GPIO.LOW)
Partager