Created
August 13, 2014 12:53
-
-
Save kashmervil/3779deb15cc3a9db6529 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Trik | |
open Trik.Junior | |
open Trik.Collections | |
open Trik.Ports | |
robot.Led.PowerOff() | |
robot.Led.SetColor LedColor.Green | |
let buttonPad = new ButtonPad("/dev/input/event0") | |
buttonPad.Start() | |
printfn "Press any key on the keyboard" | |
System.Console.ReadKey() |> ignore | |
printfn "Press any key on the controller" | |
printfn "You pressed %A" <| buttonPad.Read() | |
robot.LineSensor.Start() | |
robot.Led.SetColor LedColor.Orange | |
printfn "Press any key to detect" | |
let d = buttonPad.Read() | |
robot.LineSensor.DetectAndSet() | |
printfn "Press Enter to stop evaluating" | |
let mutable error = 0.0 | |
let isEnterPressed = buttonPad.PressCheck ButtonEventCode.Enter | |
while not !isEnterPressed do | |
let current = robot.LineSensor.Read() | |
System.Console.WriteLine("{0} {1} {2}", current.X, current.Crossroad, current.Mass) | |
error <- error + 0.1 | |
robot.Motor.[M1].SetPower(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment