EV3 Touch Sensor Not Detected
 Arduino   Started by Matha Goram   2017-08-24 23:25:23 -04:00   Comments: 3    Viewed: 134

  1. Matha Goram
    Matha Goram Member

    Hello,

    This note is on the EVShield demo program at https://github.com/mindsensors/EVShield/blob/master/EVShield_tests/ev3_touch/ev3_touch.ino which ran successfully for me several months ago; the only difference was that I used the waitForButtonPress method to detect the GO button press. Unfortunately, the same code is not working anymore (after a long hiatus but a fresh install of libraries from GitHub and Arduino 1.8.2).

    The init method for the EVs_EV3Touch class returns the value False and in the loop subprogram the methods isPressed and getBumpCount do not seem to be processing anything. I have used EV3 Touch Sensors (two different units) and an NXT model too. I have tried with the ports SH_BAS1 and SH_BAS2 without success. The EVShield hardware is the original model with the TFT UI panel. (Of course, I have not reactivated the UI code for the current exercises).

    Is there something that I need to pay attention to with respect to the version of the libraries? The examples are essentially the same as published originally (with some minor changes e.g. the GO button detection). Since EVShield.init does not return a completion code, I cannot readily check on its initialization but perhaps that is where I will have now spend my cycles - both front LEDs display a cyan color when I press the GO button in response to the prompt in the Serial Monitor window but that does not offer any diagnostic (at least for me in this particular case). I could, of course, insert a few more lines to test the EVShield LEDs before proceeding with the Touch Sensor example. (done -- see P.S. below).

    Thanks.

    Code

    myShield.init(SH_HardwareI2C); // initialize the LED related timers and communication with specified protocol
    ...
    if (!myTouch.init( &myShield, SH_BAS1 ))
          Serial.println("EV3Touch object failed to initialize on SH_BAS1"); // initialize the interface and identify the connection port as BAS1

    Serial Monitor

    EV3Touch object failed to initialize on SH_BAS1

    P.S.
    Ran the multi_color_led example subsequently after the initial note above. All LEDs displayed the colors correctly!

    Matha Goram, 2017-08-24 23:25:23 -04:00
  2. Matha Goram
    Matha Goram Member
    Hello,

    Please disregard my previous post. The issue lies with the operator (sadly, once again). The NXT Touch Sensor that I am using is probably defective? The EV3 Touch works fine on all four sensor ports and I can view the corresponding status values using the UI screen. Sorry for the false alarm.

    Thanks.
    Matha Goram, 2017-08-25 09:15:46 -04:00
  3. seth10
    seth10 Member Staff Member

    Thank you for posting, it might help someone with a similar issue in the future. I appreciate your detailed debugging, and running multi_color_led to test the colors. (good idea!)

    One useful thing to know on GitHub are the Blame and History button near the top-right. History shows you a list of each commit which has modified that file. Blame shows you which commit last modified each line. We can see that waitForButtonPress was last modified a year ago, but that commit just changed the line endings. You can click "View blame prior to this change" to see that the previous commit which modified it was the first commit from three years ago, so waitForButtonPress has not been changed.
    However, waitForButtonPress relies on getButtonState, which has been modified to support the Wi-Fi Arduino Interface for PiStorms (to use an ESP8266 and the Arduino programming language to control the PiStorms), which doesn't have a physical left/right button, only GO. Because of this the left and right buttons were mapped to the F1 and F2 software function keys for compatibility's sake.

    To be clear, this was an issue with the touch sensor, correct? Not the GO/left/right buttons? Also, it was an EV3 touch sensor, correct? Not an NXT touch sensor?

    seth10, 2017-08-25 11:02:50 -04:00
  4. (You must log in or sign up to post here)

Log in | Sign up
Tems & Conditions!
Help!