GetSensorName() public method

public GetSensorName ( ) : string
return string
コード例 #1
0
ファイル: SensorTests.cs プロジェクト: Ellerbach/BrickPi
 private async Task TestMultipleSensorsTouchCSSoud()
 {
     NXTTouchSensor touch = new NXTTouchSensor(BrickPortSensor.PORT_S2);
     EV3TouchSensor ev3Touch = new EV3TouchSensor(BrickPortSensor.PORT_S1, 20);
     NXTSoundSensor sound = new NXTSoundSensor(BrickPortSensor.PORT_S4);
     NXTColorSensor nxtlight = new NXTColorSensor(BrickPortSensor.PORT_S3);
     RGBColor rgb;
     bool bwait = true;
     while (bwait)
     {
         Debug.WriteLine(string.Format("NXT Touch, Raw: {0}, ReadASString: {1}, IsPressed: {2}, NumberNodes: {3}, SensorName: {4}", touch.ReadRaw(), touch.ReadAsString(), touch.IsPressed(), touch.NumberOfModes(), touch.GetSensorName()));
         Debug.WriteLine(string.Format("EV3 Touch, Raw: {0}, ReadASString: {1}, IsPressed: {2}, NumberNodes: {3}, SensorName: {4}", ev3Touch.ReadRaw(), ev3Touch.ReadAsString(), ev3Touch.IsPressed(), ev3Touch.NumberOfModes(), ev3Touch.GetSensorName()));
         Debug.WriteLine(string.Format("NXT Sound, Raw: {0}, ReadASString: {1}, NumberNodes: {2}, SensorName: {3}", sound.ReadRaw(), sound.ReadAsString(), sound.NumberOfModes(), sound.GetSensorName()));
         Debug.WriteLine(string.Format("NXT Color Sensor, Raw: {0}, ReadASString: {1}, NumberNodes: {2}, SensorName: {3}",
             nxtlight.ReadRaw(), nxtlight.ReadAsString(), nxtlight.NumberOfModes(), nxtlight.GetSensorName()));
         rgb = nxtlight.ReadRGBColor();
         Debug.WriteLine(string.Format("Color: {0}, Red: {1}, Green: {2}, Blue: {3}",
             nxtlight.ReadColor(), rgb.Red, rgb.Green, rgb.Blue));
         //                Debug.WriteLine(string.Format("raw {0}", nxtlight.ReadTest()));
         await Task.Delay(300);
         if ((touch.IsPressed()) && ev3Touch.IsPressed())
             bwait = false;
     }
 }