Jump to content

Jon

Members
  • Gesamte Inhalte

    4
  • Benutzer seit

  • Letzter Besuch

Jon's Achievements

Newbie

Newbie (1/14)

0

Reputation in der Community

  1. Hi, I am using the VoltageCurrentBricklet with MATLAB and need to collect voltage samples at a fixed (periodic) sample rate. Currently I am using a for loop but the timing is not very periodic. for( loop=1:NO_OF_PERIODIC_VSUPPLY_SAMPLES ) data.MyVoltageReading(loop) = hUID.getVoltage(); end; The MATLAB API bindings suggest a better method is to use the callback function and set a callback period to take a measurement. However, the VoltageCallback callback is only triggered if the voltage has changed since the last triggering. Does anyone know if it's possible to configure the callback so it always returns the sample at the requested rate regardless if the reading has changed or not? Many thanks
  2. Fantastic Photron - problem solved, Tinkerforge Callbacks are now established in MATLAB R2015b - Don't you just love undocumented features. For completeness the following updated code now produces this output. import com.tinkerforge.IPConnection; import com.tinkerforge.BrickletVoltageCurrent; ipcon = IPConnection(); % Create IP connection vc = handle(BrickletVoltageCurrent(UID, ipcon),'CallbackProperties'); >> set(vc) ans = CurrentCallbackPeriod: {} DebouncePeriod: {} PowerCallbackPeriod: {} ResponseExpectedAll: {} VoltageCallbackPeriod: {} PowerReachedCallback: {} VoltageReachedCallback: {} VoltageCallback: {} CurrentReachedCallback: {} CurrentCallback: {} PowerCallback: {} My understanding is the listeners only report when a change is detected which means I can't check if the callback is actually executing until tomorrow when I can add a test load.
  3. Hi photron Thank you for responding. Something strange is happening for me. I am using MATLAB 2015b and the Tinkerforge.jar file from the \MATLAB bindings directory (v2_0_5 file size: 980,064 bytes). In the MATLAB classpath.txt file I have this # DO NOT MODIFY THIS FILE. IT IS AN AUTOGENERATED FILE. $<Lots of MATLAB Jar files added to the path> $matlabroot/Tinkerforge.jar If I execute your simple code I get this: import com.tinkerforge.IPConnection; import com.tinkerforge.BrickletVoltageCurrent; ipcon = IPConnection(); % Create IP connection vc = BrickletVoltageCurrent(UID, ipcon); % Create device object >> set(vc) ans = CurrentCallbackPeriod: {} DebouncePeriod: {} PowerCallbackPeriod: {} ResponseExpectedAll: {} VoltageCallbackPeriod: {} >> ipcon.connect(HOST, PORT); % Can't use get without executing this >> get(vc) APIVersion: [3x1 int16] Class: [1x1 java.lang.Class] Configuration: [1x1 com.tinkerforge.BrickletVoltageCurrent$Configuration] Current: 0 CurrentCallbackPeriod: 10 CurrentCallbackThreshold: [1x1 com.tinkerforge.BrickletVoltageCurrent$CurrentCallbackThreshold] DebouncePeriod: 100 Identity: [1x1 com.tinkerforge.Device$Identity] Power: 0 PowerCallbackPeriod: 0 PowerCallbackThreshold: [1x1 com.tinkerforge.BrickletVoltageCurrent$PowerCallbackThreshold] Voltage: 0 VoltageCallbackPeriod: 0 VoltageCallbackThreshold: [1x1 com.tinkerforge.BrickletVoltageCurrent$VoltageCallbackThreshold] >> ver ver ---------------------------------------------------------------------------------------------------- MATLAB Version: 8.6.0.232648 (R2015b) MATLAB License Number: xxxxxx Operating System: Microsoft Windows 8.1 Version 6.3 (Build 9600) Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ---------------------------------------------------------------------------------------------------- MATLAB Version 8.6 (R2015b Prerelease) Signal Processing Toolbox Version 7.1 (R2015b Prerelease) Please can I ask what version of MATLAB you are using?
  4. Hi, I'm trying to run "matlab_example_callback.m" for BrickletVoltageCurrent. When the example code "set(vc, 'PowerReachedCallback', @(h, e) cb_power_reached(e));" is executed MATLAB reports the following error: java.lang.NullPointerException at com.mathworks.jmi.bean.MatlabBeanInterface.addCallback(MatlabBeanInterface.java:484) at com.mathworks.jmi.bean.MatlabCallbackInterface.addCallback(MatlabCallbackInterface.java:130) If I type set(vc) there is no callback class listed to register... Class: [1x1 java.lang.Class] Configuration: [1x1 com.tinkerforge.BrickletVoltageCurrent$Configuration] Current: 0 CurrentCallbackPeriod: 1000 CurrentCallbackThreshold: [1x1 com.tinkerforge.BrickletVoltageCurrent$CurrentCallbackThreshold] DebouncePeriod: 100 Identity: [1x1 com.tinkerforge.Device$Identity] Power: 0 PowerCallbackPeriod: 0 PowerCallbackThreshold: [1x1 com.tinkerforge.BrickletVoltageCurrent$PowerCallbackThreshold] Voltage: 0 VoltageCallbackPeriod: 0 VoltageCallbackThreshold: [1x1 com.tinkerforge.BrickletVoltageCurrent$VoltageCallbackThreshold] The example callback won't register. Does anyone have any ideas what could be wrong here? Many thanks
×
×
  • Neu erstellen...