Exemple #1
0
func testTTSAndButtons() {
	TTS.Speak("Hello! Press the following sequence of buttons:")

	fmt.Println("Press the following sequence of buttons:")
	fmt.Println("left, right, up, down, enter")

	Button.Wait(Button.Left)
	Button.Wait(Button.Right)
	Button.Wait(Button.Up)
	Button.Wait(Button.Down)
	Button.Wait(Button.Enter)
}
Exemple #2
0
func testMotors() {
	fmt.Println("Make sure there is a motor plugged in to port A and press the center button to continue.")
	Button.Wait(Button.Enter)

	fmt.Println("Running motor A")
	Motor.Run(Motor.OutPortA, 40)

	for n := 0; n < 20; n++ {
		time.Sleep(time.Second / 2)

		fmt.Printf("Running motor A with speed %d, power %d, and position %d\n", Motor.CurrentSpeed(Motor.OutPortA), Motor.CurrentPower(Motor.OutPortA), Motor.CurrentPosition(Motor.OutPortA))
	}

	Motor.Stop(Motor.OutPortA)
}