Esempio n. 1
0
 def setlights( self ):
   ''' Set all lights to self._lights value. '''
   if self._lights:
     for v in tank._HEADLIGHTS:
       pca.set(v, self._lights)
     for v in tank._TAILLIGHTS:
       pca.set(v, self._lights)
   else:
     for v in tank._HEADLIGHTS:
       pca.off(v)
     for v in tank._TAILLIGHTS:
       pca.off(v)
Esempio n. 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pca9685 as pwm
from time import sleep

pwm.init(0, 50)

MIN_VAL = 100
MAX_VAL = 500
step = 1
value = MIN_VAL
while True:

    if (value > MAX_VAL):
        step = -1
    if (value < MIN_VAL):
        step = 1
    value = value + step
    pwm.set(value, value)
    sleep(0.01)
Esempio n. 3
0
 def _shootEnter(self, aState):
     ''' Enter shooting state by setting gun to High fire rate to prevent jamming.
      Update will delay then switch to regular fire rate. '''
     aState['timer'] = _GUNSTARTDUR
     pca.set(_GUNS, _GUNSTART)
Esempio n. 4
0
 def _shoot(self, aState):
     ''' Enter method for shooting state, set gun fire rate. '''
     pca.set(_GUNS, _GUNRATE)
Esempio n. 5
0
 def _shootEND(self, aState):
     ''' Turn off guns. '''
     pca.set(_GUNS, _GUNOFF)