How to send Number to EV3 via Mailbox

HomeForumsMonoBrick Communication LibraryHow to send Number to EV3 via Mailbox

This topic contains 1 reply, has 2 voices, and was last updated by Author Image Anders Søborg 2 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4784
    Author Image
    Pandaski
    Participant

    I need to send some integer value to EV3 to be consume in EV3 program. However I can only send text but not Number type data.

    Below code can be used to send Text to EV3. But the EV3 program doesn’t support convert data from Text to Number, this code doesn’t reach my target.

    string input = Console.ReadLine();
    ev3.Mailbox.Send(“mailbox1″, input, false);

    I am not sure whether the another override of Send works. But at least below code does not work.
    byte[] intBytes = BitConverter.GetBytes(123);
    Array.Reverse(intBytes);
    byte[] result = intBytes;
    ev3.Mailbox.Send(“ScreenWidthPixel”, intBytes, false);

    Attached image is my sample EV3 program.

    Please share your advice. Thanks.

    Attachments:
    You must be logged in to view attached files.
    #4838
    Author Image
    Anders Søborg
    Key Master

    Hi

    Why are you doing a reverse of the array?

    /Anders

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

You must be logged in to reply to this topic.

Posted in

Make a donation