Geschrieben April 26, 2019 at 12:3126. Apr 2019 Hallo, kann jemand mir sagen, wie ich ContinuousAcceleration16BitCallback für Accelerometer Bricklet 2.0 nutzen. Wie so ich programmieren? Vielen dank.
Geschrieben April 26, 2019 at 13:0126. Apr 2019 Geht das etwas präziser? - den Callback gibt es nicht?? Bzw. ich habe ihn nicht gefunden - in welcher Progrmmiersprache? Oder meinst Du sowas: https://www.tinkerforge.com/de/doc/Software/Bricklets/AccelerometerV2_Bricklet_C.html#c.ACCELEROMETER_V2_CALLBACK_CONTINUOUS_ACCELERATION_16_BIT Da sind eigentlich Beispiele pro Sprache in der Doku drin? Was fehlt?
Geschrieben April 26, 2019 at 13:4126. Apr 2019 Autor Vielen Dank für ihre Antwort. Meine Progrmmiersprache ist Matlab. Die Beschreibung in der Doku ist nicht ausführlich ,und ich kann nicht sehr gut verstehen.Es gibt auch kein Beispiel für ContinuousAcceleration16BitCallback.
Geschrieben April 26, 2019 at 15:3426. Apr 2019 Hier sind doch Beispiele für Callbacks: https://www.tinkerforge.com/de/doc/Software/Bricklets/AccelerometerV2_Bricklet_MATLAB.html#accelerometer-v2-bricklet-matlab-examples
Geschrieben April 26, 2019 at 18:4526. Apr 2019 Autor Aber das ist nur ein Beispiel für AccelerationCallback, ich brauche ein Beispiel fÜr ContinuousAcceleration16BitCallback.
Geschrieben April 29, 2019 at 11:5029. Apr 2019 Anbei ein Beispiel: function matlab_example_continuous_callback() import com.tinkerforge.IPConnection; import com.tinkerforge.BrickletAccelerometerV2; HOST = 'localhost'; PORT = 4223; UID = 'XYZ'; % Change XYZ to the UID of your Accelerometer Bricklet 2.0 ipcon = IPConnection(); % Create IP connection a = handle(BrickletAccelerometerV2(UID, ipcon), 'CallbackProperties'); % Create device object ipcon.connect(HOST, PORT); % Connect to brickd % Don't use device before ipcon is connected % Register acceleration callback to function cb_acceleration set(a, 'ContinuousAcceleration16BitCallback', @(h, e) cb_continuous_acceleration(e)); % Get X, Y and Z axis continuous acceleration with 16-bit resolution a.setContinuousAccelerationConfiguration(true, true, true, BrickletAccelerometerV2.RESOLUTION_16BIT); input('Press key to exit\n', 's'); ipcon.disconnect(); end % Callback function for continuous acceleration callback function cb_continuous_acceleration(e) data_all = []; data_axis = []; for i = 1:length(e.acceleration) if mod(i, 3) ~= 0 data_axis = [data_axis double(e.acceleration(i)) / 10000.0]; else data_axis = [data_axis double(e.acceleration(i)) / 10000.0]; data_all = [data_all; data_axis]; data_axis = []; end end for i = 1:length(data_all) data_axis = data_all(i,; for j = 1:length(data_axis) if j == 1 fprintf('Acceleration [X]: %g g\n', data_axis(j)); elseif j == 2 fprintf('Acceleration [Y]: %g g\n', data_axis(j)); else fprintf('Acceleration [Z]: %g g\n\n', data_axis(j)); end end end fprintf('\n'); end
Geschrieben April 29, 2019 at 12:5429. Apr 2019 Autor Vielen Dank für ihr Progamm. Ich habe noch eine Frage, wie ich die Periode von ContinuousAcceleration16BitCallback vorgebe?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.