forked from nebhead/PiFire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrillplat_prototype.py
More file actions
executable file
·67 lines (51 loc) · 1.52 KB
/
grillplat_prototype.py
File metadata and controls
executable file
·67 lines (51 loc) · 1.52 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
# *****************************************
# PiFire Grill Platform Prototype Interface Library
# *****************************************
#
# Description: This library simulates controlling the Grill outputs via
# Raspberry Pi GPIOs, to a 4-channel relay
#
# *****************************************
# *****************************************
# Imported Libraries
# *****************************************
class GrillPlatform:
def __init__(self, outpins, inpins):
self.outpins = outpins # { 'power' : 4, 'auger' : 14, 'fan' : 15, 'igniter' : 18 }
self.inpins = inpins # { 'selector' : 17 }
self.outpins['auger'] = 1
self.outpins['fan'] = 1
self.outpins['igniter'] = 1
self.outpins['power'] = 0
self.inpins['selector'] = 0
def AugerOn(self):
self.outpins['auger'] = 0
def AugerOff(self):
self.outpins['auger'] = 1
def FanOn(self):
self.outpins['fan'] = 0
def FanOff(self):
self.outpins['fan'] = 1
def FanToggle(self):
if(self.outpins['fan'] == 0):
self.outpins['fan'] = 1
else:
self.outpins['fan'] = 0
def IgniterOn(self):
self.outpins['igniter'] = 0
def IgniterOff(self):
self.outpins['igniter'] = 1
def PowerOn(self):
self.outpins['power'] = 0
def PowerOff(self):
self.outpins['power'] = 1
def GetInputStatus(self):
return (self.inpins['selector'])
def SetInputStatus(self, value):
self.inpins['selector'] = value
def GetOutputStatus(self):
self.current = {}
for item in self.outpins:
self.current[item] = self.outpins[item]
return self.current