Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Program: test.py
- Author: Lorenzo Benevento
- Last data modified: 10-11-2013
- Description: Software usato per testare tutti i supplementi del raspberry.
- """
- #!/usr/bin/python3
- from releControll import ReleControll
- import time
- import random
- class Test(object):
- def __init__(self):
- self.rele = [7, 11, 12, 13, 15, 16, 18, 22]
- def run(self):
- self._importReleState()
- self._testRele()
- self._testMonitor()
- def _importReleState(self):
- self._releState = open("/homeControll/setting/settingRele.txt").read().split()
- def _testRele(self):
- r = ReleControll()
- r.switchRele('all', True)
- time.sleep(2)
- r.switchRele('all', False)
- for count in range(50):
- r.switchRele(self.rele[random.randint(0, 7)])
- time.sleep(0.1)
- for count in range(8):
- if self._releState[count] == 'True':
- r.switchRele(self.rele[count], True)
- else:
- r.switchRele(self.rele[count], False)
- def _testMonitor(self):
- for count in range(5000):
- print(chr(random.randint(0, 255)) + ' ' * random.randint(0, 10), end='')
- print()
Advertisement
Add Comment
Please, Sign In to add comment