func CurrentFloor() int { floor := 1 if driver.ReadBit(driver.FLOOR_IND2) { floor = floor + 1 } if driver.ReadBit(driver.FLOOR_IND1) { floor = floor + 2 } return floor }
func SetElevSpeed(speed int) { if speed == 0 { if driver.ReadBit(driver.MOTORDIR) { driver.ClearBit(driver.MOTORDIR) } else { driver.SetBit(driver.MOTORDIR) } time.Sleep(10 * time.Millisecond) } if speed > 0 { driver.ClearBit(driver.MOTORDIR) } else { driver.SetBit(driver.MOTORDIR) } driver.WriteAnalog(driver.MOTOR, 2048+4*math.Abs(speed)) }