public bool GetSensorValue(NxtBrick.Sensor sensor, out NxtBrick.SensorValues values)
        {
            SensorValues sv;
            bool ret = base.GetSensorValue((Sensor)sensor, out sv);

            values = sv;
            return ret;
        }
예제 #2
0
 public override bool ClearSensor(NxtBrick.Sensor sensor)
 {
     if (SensorDic.ContainsKey(sensor))
     {
         SensorDic[sensor] = NxtBrick.SensorType.NoSensor;
         return true;
     }
     print("no sensor {0} to clear", sensor);
     return false;
 }
예제 #3
0
        public override bool GetSensorValue(NxtBrick.Sensor sensor, out NxtBrick.SensorValues sensorValues)
        {            
            sensorValues = new NxtBrick.SensorValues();
            sensorValues.Raw = ushort.MinValue;

            if (IsConnected)
            {
                switch (SensorDic[sensor])
                {
                    case NxtBrick.SensorType.NoSensor:
                        break;
                    case NxtBrick.SensorType.Switch:
                        break;
                    case NxtBrick.SensorType.Temperature:
                        break;
                    case NxtBrick.SensorType.Reflection:
                        break;
                    case NxtBrick.SensorType.Angle:
                        break;
                    case NxtBrick.SensorType.LightActive:
                        break;
                    case NxtBrick.SensorType.LightInactive:
                        break;
                    case NxtBrick.SensorType.SoundDB:
                        break;
                    case NxtBrick.SensorType.SoundDBA:
                        break;
                    case NxtBrick.SensorType.Custom:
                        break;
                    case NxtBrick.SensorType.Lowspeed:
                        break;
                    case NxtBrick.SensorType.Lowspeed9V:
                        break;
                    default:
                        print("Problem: could not retrieve data because of unknown sensor type {0} set for sensor {1}",
                            SensorDic[sensor], sensor);
                        return false;
                }
                return true;
            }
            print("Problem: could not retrieve data because of broken connection");
            return false;
        }
 public bool SetMotorState(NxtBrick.Motor motor, NxtBrick.MotorState state)
 {
     
     return base.SetMotorState((Motor)motor, state);
 }
 public bool GetUltrasonicSensorsValue(NxtBrick.Sensor sensor, out int value)
 {
     return base.GetUltrasonicSensorsValue((Sensor)sensor, out value);
 }
 public bool SetSensorMode(NxtBrick.Sensor sensor, NxtBrick.SensorType type, NxtBrick.SensorMode mode)
 {
     return base.SetSensorMode((Sensor)sensor, (SensorType)type, (SensorMode)mode);
 }
 public bool ClearSensor(NxtBrick.Sensor sensor)
 {
     return base.ClearSensor((NXTBrick.Sensor)sensor);
 }
예제 #8
0
 public abstract bool SetSensorMode(NxtBrick.Sensor sensor, NxtBrick.SensorType type, NxtBrick.SensorMode mode);
예제 #9
0
 public abstract bool SetMotorState(NxtBrick.Motor motor, NxtBrick.MotorState state);
예제 #10
0
 public abstract bool GetUltrasonicSensorsValue(NxtBrick.Sensor sensor, out int value);
예제 #11
0
 public abstract bool GetSensorValue(NxtBrick.Sensor sensor, out NxtBrick.SensorValues sensorValues);
예제 #12
0
 public abstract bool ClearSensor(NxtBrick.Sensor sensor);
예제 #13
0
 public override bool SetSensorMode(NxtBrick.Sensor sensor, NxtBrick.SensorType type, NxtBrick.SensorMode mode)
 {
     if (IsConnected)
     {
         print("sensor port {0} set to {1} type in {2} mode", sensor, type, mode);
         if (SensorDic[sensor] != NxtBrick.SensorType.NoSensor)
         {
             print("Problem: sensor {0} already set", sensor);
             return false;
         }
         if (!SensorDic.ContainsKey(sensor))
         {
             print("Problem: sensor {0} inexistent", sensor);
             return false;
         }
         SensorDic[sensor] = type;
         return true;
     }
     print("Problem: could not retrieve data because of broken connection");
     return false;
 }
예제 #14
0
 public override bool SetMotorState(NxtBrick.Motor motor, NxtBrick.MotorState state)
 {
     throw new NotImplementedException();
 }
예제 #15
0
 public override bool GetUltrasonicSensorsValue(NxtBrick.Sensor sensor, out int value)
 {           
     if (IsConnected)
     {
         Random rand = new Random();
         value = rand.Next(256);
         return true;
     }
     print("Problem: could not retrieve data because of broken connection");
     value = -1;
     return false;
 }