Home→Forums→MonoBrick EV3 Firmware→Touch Sensor example does not compile
- This topic has 5 replies, 3 voices, and was last updated 10 years, 5 months ago by Daniel Fernández Pérez.
-
AuthorPosts
-
June 17, 2014 at 15:51 #4418
Daniel Fernández PérezParticipantHi
I’ve been trying MonoBrick for a few days, working with the display and EV3 buttons.
And now I’m trying to add some functionalities to a program with the Touch Sensor (EV3 version) but I’m not able to configure it properly. In fact I’m not even able to compile the TouchSensorExample Program!!
When I try to compile this program:
using System; using MonoBrickFirmware.UserInput; using MonoBrickFirmware.Display; using MonoBrickFirmware.Sensors; using System.Threading; namespace TouchSensorExample { class MainClass { public static void Main (string[] args) { ManualResetEvent terminateProgram = new ManualResetEvent(false); var touchSensor = new EV3TouchSensor(SensorPort.In1); //svar touchSensor = new NXTTouchSensor(SensorPort.In1); ButtonEvents buts = new ButtonEvents (); LcdConsole.WriteLine("Use touch on port1"); LcdConsole.WriteLine("Up read"); LcdConsole.WriteLine("Down read raw"); LcdConsole.WriteLine("Esc. terminate"); buts.EscapePressed += () => { terminateProgram.Set(); }; buts.UpPressed += () => { LcdConsole.WriteLine("Sensor value:" + touchSensor.ReadAsString()); }; buts.DownPressed += () => { LcdConsole.WriteLine("Raw sensor value: " + touchSensor.ReadRaw()); }; terminateProgram.WaitOne(); } } }
I get the following error: “type or name space cannot be found, maybe yo need some “using” o assembler reference” (this is a free translation of the error)
Can anyone help me?
Thanks in advance
June 17, 2014 at 19:16 #4419
Tcm0ParticipantDo you have included the MonoBrick DLL? Which line has the error?
June 18, 2014 at 13:11 #4420
Daniel Fernández PérezParticipantYes, I added the monobrick DLL, in fact, I have redownloaded and reincluded it into the project (just in case), the problematic line is exactly the line where the declaration of the sensor is made:
“var touchSensor = new EV3TouchSensor(SensorPort.In1);” yI have also tried with a NXT Sound Sensor and with the NXT declaration: “svar touchSensor = new NXTTouchSensor(SensorPort.In1);” with the same result, the error (translated from spanish): “type or name space cannot be found, maybe you have missed some “using” declaration o assembler reference” (this is a free translation of the error)
But this program is the original SoundSensor Example, unmodified. Do I have an old dll? I have downloaded from the official link.
Thanks
June 18, 2014 at 14:05 #4421
Daniel Fernández PérezParticipantI answer myself, in the documentation Library () I have just discover that the Touch Sensor Class is no longer used with “var touchSensor = new EV3TouchSensor(SensorPort.In1);” but using the following statement: “var touchSensor = new TouchSensor(SensorPort.In1);”. This new declaration is valid for NXT and EV3 touch sensors, no difference has to be made.
So the Example used before is no longer valid and declaration of touch sensor has to be changed in order to compile with the last MonoBrick DLL.
Hope it helps
June 18, 2014 at 17:58 #4423
Anders SøborgKeymasterHi
Yes the documentation is not compliant with the dll from the Git repository…
Will be updated when we make the next release. But as I have mentioned in another thread I am very busy at the moment with some private stuff. Hopefully I will have some time at the end of the week…
Anders
June 20, 2014 at 13:44 #4444
Daniel Fernández PérezParticipantThanks for your answer Anders
You are doing a great job with this project, of course we hope to see it grow and evolve but we can wait 😉
Thanks!
-
AuthorPosts
You must be logged in to reply to this topic.
Follow