コード例 #1
0
ファイル: infrared.go プロジェクト: jermon/GoEV3
func (self *InfraredSensor) ReadIRSEEK(channel int16) (int16, int16) {

	var channel1 string
	var channel2 string

	switch channel {
	case 1:
		channel1 = "value0"
		channel2 = "value1"
	case 2:
		channel1 = "value2"
		channel2 = "value3"
	case 3:
		channel1 = "value4"
		channel2 = "value5"
	case 4:
		channel1 = "value6"
		channel2 = "value7"
	}
	utilities.WriteStringValue(self.path, "mode", "IR-SEEK")
	heading := utilities.ReadInt16Value(self.path, channel1)
	distance := utilities.ReadInt16Value(self.path, channel2)
	return heading, distance
}
コード例 #2
0
ファイル: motors.go プロジェクト: jermon/GoEV3
// Reads the operating power of the motor at the given port.
func (self Motor) CurrentPower() int16 {
	return utilities.ReadInt16Value(self.folder, powerGetterFD)
}
コード例 #3
0
ファイル: motors.go プロジェクト: jermon/GoEV3
// Reads the operating speed of the motor at the given port.
func (self Motor) CurrentSpeed() int16 {
	return utilities.ReadInt16Value(self.folder, speedGetterFD)
}