Example #1
0
// 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
}
Example #2
0
// 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
}
Example #3
0
// 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
}
Example #4
0
// 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)
}