~cyber-killer/ckgpio/trunk

« back to all changes in this revision

Viewing changes to ckgpio.py

  • Committer: Łukasz "Cyber Killer" Korpalski
  • Date: 2016-03-23 17:23:10 UTC
  • Revision ID: cyberkiller8@gmail.com-20160323172310-zyji8550pehup80z
initial code for 7seg display

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
 
1
#    ckgpio - a Python3 wrapper library for Raspberry Pi GPIO
 
2
#    Copyright (C) 2016 Łukasz "Cyber Killer" Korpalski
 
3
#
 
4
#    This program is free software: you can redistribute it and/or modify
 
5
#    it under the terms of the GNU General Public License as published by
 
6
#    the Free Software Foundation, either version 3 of the License, or
 
7
#    (at your option) any later version.
 
8
#
 
9
#    This program is distributed in the hope that it will be useful,
 
10
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
#    GNU General Public License for more details.
 
13
#
 
14
#    You should have received a copy of the GNU General Public License
 
15
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 
 
17
from gpiozero import LED
 
18
 
 
19
class 7seg:
 
20
        def __init__(self,sega,segb,segc,segd,sege,segf,segg,segdot,active_high=True):
 
21
                self.sega = LED(sega,active_high=active_high)
 
22
                self.segb = LED(segb,active_high=active_high)
 
23
                self.segc = LED(segc,active_high=active_high)
 
24
                self.segd = LED(segd,active_high=active_high)
 
25
                self.sege = LED(sege,active_high=active_high)
 
26
                self.segf = LED(segf,active_high=active_high)
 
27
                self.segg = LED(segg,active_high=active_high)
 
28
                self.segdot = LED(segdot,active_high=active_high)
 
29
        def allon(self):
 
30
                self.sega.on()
 
31
                self.segb.on()
 
32
                self.segc.on()
 
33
                self.segd.on()
 
34
                self.sege.on()
 
35
                self.segf.on()
 
36
                self.segg.on()
 
37
                self.segdot.on()
 
38
        def alloff(self):
 
39
                self.sega.off()
 
40
                self.segb.off()
 
41
                self.segc.off()
 
42
                self.segd.off()
 
43
                self.sege.off()
 
44
                self.segf.off()
 
45
                self.segg.off()
 
46
                self.segdot.off()