Skip to content

Instantly share code, notes, and snippets.

@bungernut
bungernut / LJ_PWM_Stepper.lua
Last active May 15, 2024 02:02
Trying to get LJ T4 to control stepper
--This script can be used as a library of functions to configure the PWM registers for output and write new duty cycles to the PWM channel.
--PWM is available on the T7 on FIO0-FIO5 (T4 PWM is on FIO6 & FIO7)
--See the device datasheet for more information on PWM output.
-- Details about compatible DIO channels (tables 13.2-1 and -2): https://labjack.com/support/datasheets/t-series/digital-io/extended-features
-- PWM specific details: https://labjack.com/support/datasheets/t-series/digital-io/extended-features/pwm-out
--Functions to configure T7/T4
outPin = 6--FIO0. Changed if T4 instead of T7
pwmFrequency = 0 -- 50 Hz
@bungernut
bungernut / LJT4BellowsPump.lua
Created April 30, 2024 15:51
LabJackT4 BellowsPumpStepperControl
--[[
Name: BellowsPumpControl
USER Ram U16 address starts at 46180 (USER_RAM0_U16)
SPEED will be a slider from 0-2^16 resulting in a speed of 0-400 steps/sec
--]]
local MAX_SPEED = 800
local set_speed = 0 --this should execute ~1/second
@bungernut
bungernut / diskchart.ipynb
Last active September 13, 2023 15:57
diskchart.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
FROM ubuntu:20.04 as root_builder
#LABEL maintainer.name="ROOT team"
#LABEL maintainer.email="[email protected]"
# https://github.com/root-project/root-docker/blob/master/ubuntu_from_source/Dockerfile
LABEL maintainer.name="bung"
LABEL maintainer.email="[email protected]"
# ROOT version in the MAJOR.MINOR.REVISION format or a https://github.com/root-project/root branch name / tag. Example: ROOT_VERSION=6.26.00
@bungernut
bungernut / rngenerationalconcentrationplot.ipynb
Created April 24, 2023 16:12
RnGenerationalConcentrationPlot.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bungernut
bungernut / thermosiphoncalcs.ipynb
Created February 2, 2022 21:06
ThermosiphonCalcs.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bungernut
bungernut / nist_rn_xe_vappres.py
Last active January 12, 2022 03:50
Vapor Pressure Plot from NIST Data
!apt install texlive-fonts-recommended texlive-fonts-extra cm-super dvipng
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
import numpy as np
from scipy.optimize import minimize
from google.colab import files
from requests import get
import pandas as pd
from bs4 import BeautifulSoup
@bungernut
bungernut / mqtt_triggerscope.ino
Created July 30, 2021 02:29
MQTT upload simulated trigger scope waveforms tester
#include "WPA_secrets.h"
#include <Arduino.h>
#include <WiFi.h>
#include <SPI.h>
#include <Ethernet.h>
#include <time.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
#include "Adafruit_MQTT.h"
@bungernut
bungernut / modbus_convert_data.py
Created July 29, 2021 16:34
Modbus conversion functions from LabJack
'''
Helpful functions for converting register data to numbers and vice versa.
'''
import struct
def float2int(num):
return struct.unpack("=i", struct.pack("=f", num))[0]
@bungernut
bungernut / modbus_float2reg.ino
Created July 28, 2021 03:02
Modbus float32 to uint16_t conversion for registers
/*
Figuring out how to convert floats to uint16_t for Modbus and vice-versa
Serial Output:
Float 3.14 = [16456 , 62915]
[ 5243 , 16830 ] = 23.76
*/
#include <Arduino.h>
float f = 3.14;