Perhaps you should consider using my driver suite (link below in my signature) and have a look at the mindsensors-irdist* files. You should not really be using 3.54 if you want to retain your sanity, stick to 3.55B2. Anyway, I have modified your code and pasted it below. Some notes:

Do not use tight while loops (with nothing in them), use EndTimeSlice() instead.

Make sure you use unsigned bytes (ubytes), not sbytes when reading from your sensors

Use writeDebugStreamLine() in your code to see where things go wrong

Do not put text above the #pragma lines, it messes with the sensor and motor configuration tool

Unless there is no other way, avoid using SetSensorType to configure a sensor as I2C, it's better (and easier) to use the sensor and motor configuration tool, especially if you're already using it for other sensors.

Write your code with expectation of sharing it, that means use English variable and function names and comments. It's OK to add both English and whatever your native tongue happens to be (French in your case). Fortunately, my French is OK, so I was able to understand most of, but not everyone has that ability.

Take a look at the ROBOTC Driver Suite, it will save you a LOT of work.

Hope this helps! The code below was tested with a Dist-NX V2 (functionally the same as the V3) on ROBOTC 3.55 B2.

task main(){ Cde_CapteurIR(true); wait1Msec(50); // it is much easier to see that you want to wait // 50 ms when you use that number, rather than the 10ms wait call while(true){ nxtDisplayCenteredTextLine (0,"%3d", Mesure_Distance()); wait1Msec (15); }}

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum