Skip to content
Snippets Groups Projects
Commit 202c4a89 authored by esarrey's avatar esarrey
Browse files

Working hall sensor

parent b8b82f22
No related branches found
No related tags found
No related merge requests found
{
"CurrentProjectSetting": null
}
\ No newline at end of file
{
"Interpreter": "CondaEnv|CondaEnv|MOKE"
}
\ No newline at end of file
File added
File added
File added
...@@ -7,6 +7,7 @@ UI interface for the miniMOKE experimental setup. ...@@ -7,6 +7,7 @@ UI interface for the miniMOKE experimental setup.
This project requires a conda or miniconda environment with python3.11 This project requires a conda or miniconda environment with python3.11
```bash ```bash
pip install pythonnet
pip install pymeasure pip install pymeasure
pip install thorlabs-apt pip install thorlabs-apt
pip install nidaqmx pip install nidaqmx
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace HU_CS_Single_Probe_Example
{
public partial class Form1 : Form
{
MagnetPhysik.HallProbe myProbe; // requires reference to MagnetPhysik.Usb.dll
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
myProbe = new MagnetPhysik.HallProbe();
if (MagnetPhysik.HallProbe.NumberOfProbes < 1)
{
MessageBox.Show(MagnetPhysik.HallProbe.ErrorMessage, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
label1.Text = string.Concat("Probe No. ", myProbe.SerialNumber.ToString());
timer1.Interval = 500;
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
textBox1.Text = myProbe.Tesla.ToString();
}
}
}
;
\ No newline at end of file
...@@ -2,23 +2,24 @@ import ctypes ...@@ -2,23 +2,24 @@ import ctypes
import time import time
import sys import sys
import clr import clr
import platform
# Load the DLL print(platform.architecture())
# asm = ctypes.cdll.LoadLibrary("C:\\Program Files (x86)\\Magnet-Physik\\USB Teslameter\\MagnetPhysik.Usb.dll")
# clr.AddReference(r"C:/Program Files (x86)/Magnet-Physik/USB Teslameter/MagnetPhysik.Usb.dll") # Load the DLL
sys.path.append(r"C:/Program Files (x86)/Magnet-Physik/USB Teslameter/")
clr.AddReference("MagnetPhysik.Usb")
ctypes.WinDLL(r"C:/Program Files (x86)/Magnet-Physik/USB Teslameter/MagnetPhysik.Usb.dll") from MagnetPhysik import HallProbe
# Instantiate Hally - without knowing the exact method to instantiate an object, I am assuming it's 'HallProbe' # Instantiate Hally - without knowing the exact method to instantiate an object, I am assuming it's 'HallProbe'
# Hally = asm.HallProbe() hally = HallProbe()
# print("Why\n")
# # Get Tesla value # # Get Tesla value
# tesla = Hally.Tesla tesla = hally.Tesla
# # Loop to print Tesla value every half a second # # Loop to print Tesla value every half a second
# for x in range(100): for x in range(100):
# print(f"Field[T]: {str(Hally.Tesla())}") print("Field[T]: ", hally.Tesla)
# time.sleep(0.5) time.sleep(0.5)
import logging
from logging import _Level
class StatusBarHandler(logging.Handler):
def __init__(self, status_bar, level: _Level = 0):
super().__init__(level)
self.status_bar = status_bar
def emit(self, record)
message = self.format(record)
self.status_bar.show(message, 0)
\ No newline at end of file
...@@ -30,6 +30,7 @@ import subprocess ...@@ -30,6 +30,7 @@ import subprocess
import pyqtgraph as pg import pyqtgraph as pg
from PyQt5.QtWidgets import QStatusBar
from pymeasure.display.browser import BrowserItem from pymeasure.display.browser import BrowserItem
from pymeasure.display.manager import Manager, Experiment from pymeasure.display.manager import Manager, Experiment
from pymeasure.display.Qt import QtCore, QtWidgets, QtGui from pymeasure.display.Qt import QtCore, QtWidgets, QtGui
...@@ -210,6 +211,9 @@ class UIWindowBase(QtWidgets.QMainWindow): ...@@ -210,6 +211,9 @@ class UIWindowBase(QtWidgets.QMainWindow):
def _layout(self): def _layout(self):
self.main = QtWidgets.QWidget(self) self.main = QtWidgets.QWidget(self)
self.statusBar = QStatusBar()
self.setStatusBar(self.statusBar)
inputs_widget = QtWidgets.QWidget() inputs_widget = QtWidgets.QWidget()
inputs_vbox = QtWidgets.QVBoxLayout(inputs_widget) inputs_vbox = QtWidgets.QVBoxLayout(inputs_widget)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment