Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)

src/b/r/BrickPython-0.4/test/TestSensor.py   BrickPython(Download)
 
import unittest
from BrickPython.BrickPi import PORT_1
from BrickPython.Sensor import Sensor, TouchSensor, UltrasonicSensor, LightSensor
import TestScheduler
    def testSensor(self):
        sensor = Sensor( PORT_1 )
        self.assertEquals(sensor.port, PORT_1)
        assert( sensor.idChar == '1' )
        assert( sensor.value() == 0 )

src/b/r/BrickPython-0.4/test/TestBrickPiWrapper.py   BrickPython(Download)
 
from BrickPython.BrickPiWrapper import BrickPiWrapper
from BrickPython.BrickPi import BrickPi, PORT_1, TYPE_SENSOR_ULTRASONIC_CONT,\
    TYPE_SENSOR_RAW
from BrickPython.Sensor import Sensor
    def testSensorSetup(self):
        bp = BrickPiWrapper( {PORT_1: TYPE_SENSOR_ULTRASONIC_CONT} )
        assert( BrickPi.SensorType[PORT_1] == TYPE_SENSOR_ULTRASONIC_CONT)
 
    def testSensorSetupBetterScopingSyntax(self):
        bp = BrickPiWrapper( {'1': Sensor.ULTRASONIC_CONT} )
        self.assertEquals( BrickPi.SensorType[PORT_1], TYPE_SENSOR_ULTRASONIC_CONT)
 
    def testSensorSetupWithSensorObject(self):
        bp = BrickPiWrapper( {PORT_1: Sensor})