How do I get the right readings from a NXT magnetic sensor?

1 次查看(过去 30 天)
Hi, I'm currently working on a project that involves matlab being able to continuously get readings from a "HiTechnic magnetic sensor". But apparently matlab doesn't fully support that specific sensor, so my proffesor said that I should try and use one of these sensors code in it's place: https://wiki.qut.edu.au/display/cyphy/Device+Types He also said that I should try and use this code to try and get it to work:
reading = b.inputReadSI(0,Device.Port1,Device.X)'
But no matter which one I try it either doesn't work or give the same "50.6716" value no matter how strong the surronding magnetic field is. Does anyone know how I should fix this. The code I'm currently working with is:
b = Brick('ioType','usb');
tic;
while (toc <= 30) % Runs for 30 sec'
pause(0.5);
reading = b.inputReadSI(0,Device.Port1,Device.X) %The part named "Device.X" is where I test the different sensors.
disp(reading);
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by