Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HT-nxt-angle #3

Open
cho934 opened this issue Mar 25, 2016 · 13 comments
Open

HT-nxt-angle #3

cho934 opened this issue Mar 25, 2016 · 13 comments

Comments

@cho934
Copy link
Contributor

cho934 commented Mar 25, 2016

Hi,

I'm trying to use HT-nxt-angle, but I don't see how to use it using ev3dev-lang-demo or ev3dev-lang-test.
Moreover I saw some issues (ev3dev/ev3dev#555)

Could you please help me ?

@ddemidov
Copy link
Owner

I don't have the sensor, but it should be possible to use it with the generic sensor class. Something like this should work:

using namespace ev3dev;
sensor angle(INPUT_AUTO, {"ht-nxt-angle"});
assert(angle.connected());

angle.set_mode("ANGLE");
std::cout << angle.value(0) << std::endl;

See HiTechnic NXT Angle Sensor for description of the sensor modes and values.

@cho934
Copy link
Contributor Author

cho934 commented May 12, 2016

I'm waiting next release of ev3dev-lang-cpp linked to the last kernel which fix some issues with the NXT angle sensor.

@ddemidov
Copy link
Owner

See #5.

@cho934
Copy link
Contributor Author

cho934 commented Mar 30, 2019

I'm trying to not use INPUT_AUTO but specify the port.

using namespace ev3dev;
sensor angleRight(INPUT_1, {"ht-nxt-angle"});
sensor angleLeft(INPUT_4, {"ht-nxt-angle"});

And I received always the same error :

terminate called after throwing an instance of 'std::system_error'
  what():  no device connected: Function not implemented
Aborted
robot@ev3dev:~$ uname -a
Linux ev3dev 4.4.87-22-ev3dev-ev3 #1 PREEMPT Sat Sep 9 14:45:55 CDT 2017 armv5tejl GNU/Linux

What's wrong ?

@cho934
Copy link
Contributor Author

cho934 commented Mar 30, 2019

Succeed ! I replaced INPUT_1 and 4 by
sensor angleRight("in1:i2c1", {"ht-nxt-angle"});
sensor angleLeft("in4:i2c1", {"ht-nxt-angle"});

@timstr
Copy link

timstr commented Dec 11, 2020

I was not able to get the HiTechnic Accel sensor working as described in cho934's last post, but the following combinations worked for me. Note the addition of ev3-ports: to the sensor address:

auto accel = sensor(INPUT_AUTO, {"ht-nxt-accel"}); // Works
auto accel = sensor("ev3-ports:in1:i2c1", {"ht-nxt-accel"}); // Works
auto accel = sensor("ev3-ports:in1:i2c1"); // Works

whereas the following did not, and left the sensor reporting that it was not connected:

auto accel = sensor("in1:i2c1", {"ht-nxt-accel"}); // DOESN'T work
auto accel = sensor("in1:i2c1"); // DOESN'T work

@ddemidov
Copy link
Owner

Thanks for posting this, the port names have probably changed since then

@Eisverygoodletter
Copy link

Does anyone know where the port names are recorded / is there a changelog somewhere that says what the port names should be?

@cho934
Copy link
Contributor Author

cho934 commented Apr 12, 2022

Hi,
We can see it in the lcd menu.
I had this port name in input1: "ev3-ports:in1:i2c1"

@Eisverygoodletter
Copy link

Is there some consistent pattern in the port naming (that I can use to predict the port name given the sensor and the input port)? I remember my HiTechnic Irseeker V2 sensor had a port ev3-ports:in8:i2c3 or something, which was really weird to me.

@Eisverygoodletter
Copy link

Eisverygoodletter commented Apr 12, 2022

I just checked, and it's actually "...in(port number here):i2c8" Does anyone know why it is i2c8 instead of i2c1? Thanks in advance

@Eisverygoodletter
Copy link

Side note: HiTechnic compass sensor has i2c1 instead of i2c8 like the irseeker sensor

@Eisverygoodletter
Copy link

After some searching around, i found this https://github.com/ev3dev/lego-linux-drivers/blob/1b387f3bacb4ab8f623494d29a855de6163c8dec/sensors/nxt_i2c_sensor_defs.c#L752 and https://github.com/ev3dev/lego-linux-drivers/blob/1b387f3bacb4ab8f623494d29a855de6163c8dec/sensors/nxt_i2c_sensor_defs.c#L1342 . It seems like the naming rule for an i2c port is ev3-ports:in<port number here>:i2c<default_address here>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants