forked from ve3sjk/SkyWeather-Python-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
executable file
·41 lines (25 loc) · 856 Bytes
/
example.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#
#
# SDL_Pi_GrovePowerDrive example
# Raspberry Pi Driver for the SwitchDoc Labs GrovePowerDrive
#
# SwitchDoc Labs
# April 2017
#
# Version 1.1
# assumes device is plugged into GPIO Pin 4/5 (D4/D5 of Pi2Grover board)
import SDL_Pi_GrovePowerDrive
import time
GPIO_Pin_PowerDrive_Sig1 = 4
GPIO_Pin_PowerDrive_Sig2 = 5
myPowerDrive = SDL_Pi_GrovePowerDrive.SDL_Pi_GrovePowerDrive(GPIO_Pin_PowerDrive_Sig1, GPIO_Pin_PowerDrive_Sig2, True, True)
print "turning Pin %i off" % GPIO_Pin_PowerDrive_Sig1
myPowerDrive.setPowerDrive(1, False)
time.sleep(60)
myPowerDrive.setPowerDrive(2, False)
print "turning Pin %i off" % GPIO_Pin_PowerDrive_Sig2
time.sleep(60)
print "turning Pin %i on" % GPIO_Pin_PowerDrive_Sig1
myPowerDrive.setPowerDrive(1, True)
print "turning Pin %i on" % GPIO_Pin_PowerDrive_Sig2
myPowerDrive.setPowerDrive(2, True)