Lorenzo1818

Module - Test

Nov 10th, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 0 0
  1. """
  2. Program: test.py
  3. Author: Lorenzo Benevento
  4. Last data modified: 10-11-2013
  5. Description: Software usato per testare tutti i supplementi del raspberry.
  6. """
  7. #!/usr/bin/python3
  8.  
  9. from releControll import ReleControll
  10. import time
  11. import random
  12.  
  13. class Test(object):
  14.  
  15.     def __init__(self):
  16.         self.rele = [7, 11, 12, 13, 15, 16, 18, 22]
  17.  
  18.     def run(self):
  19.         self._importReleState()
  20.         self._testRele()
  21.         self._testMonitor()
  22.  
  23.     def _importReleState(self):
  24.         self._releState = open("/homeControll/setting/settingRele.txt").read().split()
  25.  
  26.     def _testRele(self):
  27.         r = ReleControll()
  28.         r.switchRele('all', True)
  29.         time.sleep(2)
  30.         r.switchRele('all', False)
  31.         for count in range(50):
  32.             r.switchRele(self.rele[random.randint(0, 7)])
  33.             time.sleep(0.1)
  34.         for count in range(8):
  35.             if self._releState[count] == 'True':
  36.                 r.switchRele(self.rele[count], True)   
  37.             else:
  38.                 r.switchRele(self.rele[count], False)
  39.  
  40.     def _testMonitor(self):
  41.         for count in range(5000):
  42.             print(chr(random.randint(0, 255)) + ' ' * random.randint(0, 10), end='')
  43.         print()
Advertisement
Add Comment
Please, Sign In to add comment