Open cho934 opened 8 years ago
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.
I'm waiting next release of ev3dev-lang-cpp linked to the last kernel which fix some issues with the NXT angle sensor.
See #5.
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 ?
Succeed ! I replaced INPUT_1 and 4 by sensor angleRight("in1:i2c1", {"ht-nxt-angle"}); sensor angleLeft("in4:i2c1", {"ht-nxt-angle"});
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
Thanks for posting this, the port names have probably changed since then
Does anyone know where the port names are recorded / is there a changelog somewhere that says what the port names should be?
Hi, We can see it in the lcd menu. I had this port name in input1: "ev3-ports:in1:i2c1"
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.
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
Side note: HiTechnic compass sensor has i2c1 instead of i2c8 like the irseeker sensor
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>
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 (https://github.com/ev3dev/ev3dev/issues/555)
Could you please help me ?