Getting button event in F# with MonoBrickFirmware

HomeForumsMonoBrick EV3 FirmwareGetting button event in F# with MonoBrickFirmware

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4968
    Author Image
    Hasan Sait ARSLAN
    Participant

    Hi!

    I cannot find a way how to fetch the data of button events. This is
    the Java code I want to write in F#.

    int event = Button.waitForAnyEvent();

    switch (event)
    {
    case UP_Press:
    forward(pen);
    break;

    case DOWN_Press:
    reverse(pen);
    break;

    case UP_Release:
    case DOWN_Release:
    stop(pen);
    break;

    case RIGHT_Press:
    forward(assembly);
    break;

    case LEFT_Press:
    reverse(assembly);
    break;

    case RIGHT_Release:
    case LEFT_Release:
    stop(assembly);
    break;

    case CENTER_Press:
    flag = false;
    }

    let event = MonoBrickFirmware.UserInput.ButtonEvents()

    how should I find the same data in monobrick library?

    #4972
    Author Image
    Anders Søborg
    Keymaster

    Hi there

    Thanks for using MonoBrick firmware. This is shown in several of the examples on Github – like the touch sensor example found here

    /Anders

    #4976
    Author Image
    Hasan Sait ARSLAN
    Participant

    I have tried it, it didn’t work in F#.

    #4977
    Author Image
    Hasan Sait ARSLAN
    Participant

    For instance, in F#, I cannot see the value like EnterPressed. but I see add_EnterPressed and remove_EnterPressed.

    what does it mean?

    #4978
    Author Image
    Anders Søborg
    Keymaster

    Hi Hasan

    I am no expert in F# – but try to share some code then maybe others might be able to help.

    /Anders

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Posted in

Make a donation