EV3IRSensor doesn't start

HomeForumsMonoBrick EV3 FirmwareEV3IRSensor doesn't start

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4474
    Author Image
    Tarek Shatat
    Participant

    I used Ev3ColorSensor and Lcd and motors with monobrick dll , but when I tried to interface EV3IRSensor the program Compiled Correctly on both Xmarin and visual studio , an downloaded to app folder via wifi , when I execute it Monobrick logo appears for a moment and then nothing and go back to app folder .
    I tried the demo on Github also , Is there Any solution ??

    #4475
    Author Image
    Tcm0
    Participant

    Could you please post your sourcecode?
    Do you have copied the *.dll to the brick, too?
    Do other files work?

    #4479
    Author Image
    Tarek Shatat
    Participant

    using System;
    using MonoBrickFirmware.Display;
    using MonoBrickFirmware.UserInput;
    using MonoBrickFirmware.Sensors;
    using System.Threading;
    namespace IRSensorExample
    {
    class MainClass
    {
    public static void Main (string[] args)
    {
    IRChannel[] channels = {IRChannel.One, IRChannel.Two, IRChannel.Three, IRChannel.Four};

    int channelIdx = 0;
    ManualResetEvent terminateProgram = new ManualResetEvent(false);
    var sensor = new EV3IRSensor(SensorPort.In1);
    ButtonEvents buts = new ButtonEvents ();
    LcdConsole.WriteLine(“Use IR on port1”);
    LcdConsole.WriteLine(“Up distance”);
    LcdConsole.WriteLine(“Down beacon location”);
    LcdConsole.WriteLine(“Enter read command”);
    LcdConsole.WriteLine(“Left change channel”);
    LcdConsole.WriteLine(“Right read as string”);
    LcdConsole.WriteLine(“Esc. terminate”);
    buts.EscapePressed += () => {
    terminateProgram.Set();
    };
    buts.UpPressed += () => {
    LcdConsole.WriteLine(“Distance ” + sensor.ReadDistance() + ” cm”);
    };
    buts.EnterPressed += () => {
    LcdConsole.WriteLine(“Remote command ” + sensor.ReadRemoteCommand() + ” on channel ” + sensor.Channel);
    };
    buts.DownPressed += () => {
    BeaconLocation location = sensor.ReadBeaconLocation();
    LcdConsole.WriteLine(“Beacon location: ” + location.Location + ” Beacon distance: ” + location.Distance + ” cm”);

    };
    buts.LeftPressed += () => {
    channelIdx = (channelIdx+1)%channels.Length;
    sensor.Channel = channels[channelIdx];
    LcdConsole.WriteLine(“Channel is set to: ” + channels[channelIdx]);
    };
    buts.RightPressed += () => {
    LcdConsole.WriteLine(sensor.ReadAsString());
    };
    terminateProgram.WaitOne();

    }
    }
    }
    This is the source code found on github .
    Color sensor and lcd and motor works properly , I didn’t copy the dll onto the brick .
    I will try to copy it within 5 hours and make you updated .
    Great thanks for both your effort and support .

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

You must be logged in to reply to this topic.

Posted in

Make a donation