From 2cf2b7253e9c71967a04d43e1164483178f5d6ee Mon Sep 17 00:00:00 2001 From: gboedecker <125995107+gboedecker@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:45:26 +0100 Subject: [PATCH 1/4] Create DC2200_NET.m --- Matlab/DC2200 LED Controller/DC2200_NET.m | 53 +++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Matlab/DC2200 LED Controller/DC2200_NET.m diff --git a/Matlab/DC2200 LED Controller/DC2200_NET.m b/Matlab/DC2200 LED Controller/DC2200_NET.m new file mode 100644 index 0000000..bc32888 --- /dev/null +++ b/Matlab/DC2200 LED Controller/DC2200_NET.m @@ -0,0 +1,53 @@ +% Title: DC2200_NET_NET.m +% Created Date: 2026-03-24 +% Last modified date: 2023-12-15 +% Matlab Version:R2023a +% Thorlabs DLL version:1.6.2181.41 +%% Notes:The example connects to a DC2200 device, changes the current setpoint and switches on light output +% The example uses methods from the .NET SDK +% +clear all; +NET.addAssembly('C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Thorlabs.TLDC2200_64.Interop.dll'); +import Thorlabs.TLDC2200_64.Interop.*; + +%Uncomment the next line to see an overview of the available functions +%methodsview('Thorlabs.TLDC2200_64.Interop.TLDC2200') + +%Create a dummy TLUP object to check for compatible devices. +handle = System.IntPtr(0); +tldc2200 = TLDC2200(handle); + +%Look for connected devices +[~,deviceCount] =tldc2200.get_device_count(); +disp([num2str(deviceCount),' available devices']); + +if deviceCount == 0 + disp('Unable to find compatible connected devices. Is the device connected, on, and using the TLUP driver? '); + return +end + + + +%display device information +instrumentName=System.Text.StringBuilder(256); +serialNumber=System.Text.StringBuilder(256); +manufacturer=System.Text.StringBuilder(256); +resourcename=System.Text.StringBuilder(256); +tldc2200.get_device_info(0, manufacturer,instrumentName,serialNumber,resourcename); +%tldc2200.GetResourceInformation(0, manufacturer,modelname,); +disp(manufacturer.ToString); +disp(instrumentName.ToString); +disp(serialNumber.ToString); + +%initialize +device = TLDC2200(resourcename.ToString(), false, false); + +%set current and enable output +device.setOperationMode(0); +device.setConstCurrent(0.01); +device.setLedOnOff(true);%switch on LED +pause(2) + +device.setLedOnOff(false);%switch off LED + +device.Dispose();%disconnect \ No newline at end of file From 0ec491fd1c1d98591a0df9cbddfe1a1e0eef5921 Mon Sep 17 00:00:00 2001 From: gboedecker <125995107+gboedecker@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:47:03 +0100 Subject: [PATCH 2/4] Fix comment for TLDC2200 object initialization --- Matlab/DC2200 LED Controller/DC2200_NET.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Matlab/DC2200 LED Controller/DC2200_NET.m b/Matlab/DC2200 LED Controller/DC2200_NET.m index bc32888..28728a7 100644 --- a/Matlab/DC2200 LED Controller/DC2200_NET.m +++ b/Matlab/DC2200 LED Controller/DC2200_NET.m @@ -13,7 +13,7 @@ %Uncomment the next line to see an overview of the available functions %methodsview('Thorlabs.TLDC2200_64.Interop.TLDC2200') -%Create a dummy TLUP object to check for compatible devices. +%Create a dummy TLDC2200 object to check for compatible devices. handle = System.IntPtr(0); tldc2200 = TLDC2200(handle); @@ -50,4 +50,4 @@ device.setLedOnOff(false);%switch off LED -device.Dispose();%disconnect \ No newline at end of file +device.Dispose();%disconnect From 55da78c09d2b51ca67835b8fd78a5de8a691ec5a Mon Sep 17 00:00:00 2001 From: gboedecker <125995107+gboedecker@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:49:38 +0100 Subject: [PATCH 3/4] Update last modified date in DC2200_NET.m --- Matlab/DC2200 LED Controller/DC2200_NET.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Matlab/DC2200 LED Controller/DC2200_NET.m b/Matlab/DC2200 LED Controller/DC2200_NET.m index 28728a7..d0409f9 100644 --- a/Matlab/DC2200 LED Controller/DC2200_NET.m +++ b/Matlab/DC2200 LED Controller/DC2200_NET.m @@ -1,6 +1,6 @@ % Title: DC2200_NET_NET.m % Created Date: 2026-03-24 -% Last modified date: 2023-12-15 +% Last modified date: 2026-03-24 % Matlab Version:R2023a % Thorlabs DLL version:1.6.2181.41 %% Notes:The example connects to a DC2200 device, changes the current setpoint and switches on light output @@ -26,8 +26,6 @@ return end - - %display device information instrumentName=System.Text.StringBuilder(256); serialNumber=System.Text.StringBuilder(256); From 83c4e2e8591eef0ea9b720a670a150f52b7b3e77 Mon Sep 17 00:00:00 2001 From: gboedecker <125995107+gboedecker@users.noreply.github.com> Date: Thu, 16 Apr 2026 10:33:23 +0200 Subject: [PATCH 4/4] Add user prompt before activating LED Prompt user to press enter before turning on the LED. --- Matlab/DC2200 LED Controller/DC2200_NET.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Matlab/DC2200 LED Controller/DC2200_NET.m b/Matlab/DC2200 LED Controller/DC2200_NET.m index d0409f9..2db0c09 100644 --- a/Matlab/DC2200 LED Controller/DC2200_NET.m +++ b/Matlab/DC2200 LED Controller/DC2200_NET.m @@ -43,6 +43,7 @@ %set current and enable output device.setOperationMode(0); device.setConstCurrent(0.01); +input('Press enter to turn on the light', 's'); device.setLedOnOff(true);%switch on LED pause(2)