コード例 #1
0
ファイル: infrared.go プロジェクト: jermon/GoEV3
// Reads the proximity value (in range 0 - 100) reported by the infrared sensor. A value of 100 corresponds to a range of approximately 70 cm.
func (self *InfraredSensor) ReadProximity() uint8 {

	utilities.WriteStringValue(self.path, "mode", "IR-PROX")
	value := utilities.ReadUInt8Value(self.path, "value0")

	return value
}
コード例 #2
0
ファイル: color.go プロジェクト: jermon/GoEV3
// Reads the ambient light intensity in range [0, 100].
func (self *ColorSensor) ReadAmbientLightIntensity() uint8 {
	utilities.WriteStringValue(self.path, "mode", "COL-AMBIENT")
	value := utilities.ReadUInt8Value(self.path, "value0")

	return value
}
コード例 #3
0
ファイル: color.go プロジェクト: jermon/GoEV3
// Reads the reflected light intensity in range [0, 100].
func (self *ColorSensor) ReadReflectedLightIntensity() uint8 {
	utilities.WriteStringValue(self.path, "mode", "COL-REFLECT")
	value := utilities.ReadUInt8Value(self.path, "value0")

	return value
}
コード例 #4
0
ファイル: color.go プロジェクト: jermon/GoEV3
// Reads one of seven color values.
func (self *ColorSensor) ReadColor() Color {
	utilities.WriteStringValue(self.path, "mode", "COL-COLOR")
	value := utilities.ReadUInt8Value(self.path, "value0")

	return Color(value)
}