Home→Forums→MonoBrick EV3 Firmware→EV3IRSensor doesn't start
- This topic has 2 replies, 2 voices, and was last updated 11 years, 4 months ago by  Tarek Shatat. Tarek Shatat.
- 
		AuthorPosts
- 
		
			
				
July 1, 2014 at 16:49 #4474 
 Tarek ShatatParticipantI 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 ??July 2, 2014 at 14:22 #4475 
 Tcm0ParticipantCould you please post your sourcecode? 
 Do you have copied the *.dll to the brick, too?
 Do other files work?July 6, 2014 at 02:38 #4479 
 Tarek ShatatParticipantusing 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 .
- 
		AuthorPosts
You must be logged in to reply to this topic.

 
		 
		 
		 
		 
		 
		
Follow