ROBOTC.net forums
http://robotc.net/forums/

SensorType seem "read only" on my EV3
http://robotc.net/forums/viewtopic.php?f=1&t=14373
Page 1 of 1

Author:  Bichon [ Mon May 16, 2016 5:29 pm ]
Post subject:  SensorType seem "read only" on my EV3

Hi,

Until now, I was using a NXT brick for my robots. But now the drivers seem up to date for all my sensors, I tried to go now on a EV3 brick.
That doesn't work at all and I tried to see what is the source of my issues. It seems to come from sensor configuration that I can't change. I made the following code :
Code:
#pragma config(Sensor, S1,     sensor1,        sensorEV3_GenericI2C)
#pragma config(Sensor, S2,     sensor2,              sensorEV3_Touch)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

int var1,var2=50;
task main()
{

   while(1)
   {
      var1 = SensorType[S1];
      var2 = SensorType[S2];
      wait1Msec (1000);
   }
}
Just to see why i2cwrite function told me my sensors were not well configured.

With this code running on my EV3, I read var1 and var2 on my debug window. Both equal to 0, whatever the initial configuration. Even if I force the SensorType of S1 or S2 into my code, it doesn't change anything.

If I use the "Test I2C sensors utility", it works fine and I can use my i2C sensors.
What have I done wrong?

I'm using RobotC 4.32, WindowsXP 32bits, linuxKernel 107x.bin and latest firmware.

Thx,

Author:  Bichon [ Thu May 19, 2016 5:57 am ]
Post subject:  Re: SensorType seem "read only" on my EV3

I have more clues after having tested different things on my EV3:

When I connect a well known sensor (EV3Touch for example), the program gives me the good SensorType into my variable. If it's another kind of sensor (RCX Motor Mux for example), then the brick doesn't recognize it and says there is no sensor (in my program) and answer 0.

If I use the "Test I2C sensors utility", it works fine, I can use the I2C device using this tool. Then if I launch my program, it recognize that the SensorType is sensorEV3_GenericI2C.
But if I unplug then plug my device, it seems to search what kind of sensor is plugged and as it doesn't recognize it, it answers 0.

So my questions now are :
- Why the brick doesn't recognize my RCXmotorMux as a known I2C device, although the drivers are in the sample programs?
- Why does it try to recognize which i2c device as I try to force the SensorType in my program?
- Is there a way to avoid this and to really force the SensorType inside the program?

Thank you for your help.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/