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

2 vues (au cours des 30 derniers jours)
Karl-Axel Ruuth
Karl-Axel Ruuth le 7 Déc 2017
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

Réponses (0)

Catégories

En savoir plus sur MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by