Problem using EV3 Sensor Adaptor
 Software and Programming Related   Started by Graemeloww S   2015-09-11 11:15:51 -04:00   Comments: 2    Viewed: 433

  1. Graemeloww S
    Graemeloww S Member

    Postby Graeme Low » Fri Jul 11, 2014 10:25 pm

    Hi

    I recently purchased the NXShield-Dx to interface an Arduino Uno with my EV3 kit and have so far been successful in using the Uno to control motors and the onboard RGB led. I'm now trying to run the simple program below that is supposed to serial print whether an EV3 touch sensor has been pressed or not:
        #include 
        #include 
        #include 
    
        NXShield nx;
        NXTTouch button;
    
        void setup()
        {
          Serial.begin(115200);
          delay(2000);
         
          nx.init(SH_HardwareI2C);
          button.init(&nx, SH_BBS1);
        }
    
        void loop()
        {
          Serial.println(button.isPressed());
          delay(500);
        }
    I have an EV3 Sensor Adaptor between the sensor and the shield and the host end of this is plugged into port BBS1. The code uploads and runs successfully, but the only reading I ever get from the sensor is 0 regardless of whether the touch sensor is pressed or not. I have also tried using button.readRaw() and get a constant 1020 value regardless of sensor state. Any ideas?
    Graemeloww S, 2015-09-11 11:16:45 -04:00
  2. Mindsensors Support
    Mindsensors Support Member Richmond

    Postby support » Sat Jul 12, 2014 6:35 am

    EV3 sensor adapter is meant for UART sensors (such as Gyro/light/IR/new Ultrasonic, etc).
    The Touch sensor is simply analog sensor, so you shouldn't need sensor adapter.
    (just connect Touch sensor directly to NXShield).
    Mindsensors Support, 2015-09-11 11:21:48 -04:00
  3. (You must log in or sign up to post here)

Log in | Sign up
Tems & Conditions!
Help!