Skip to content

Instantly share code, notes, and snippets.

@BananaHemic
BananaHemic / HX711.c
Last active June 19, 2024 23:18
NRF52 HX711
// For more information, please refer to https://devzone.nordicsemi.com/f/nordic-q-a/34112/best-approach-to-interface-hx711-with-nordic-nrf52832
// Feel free to comment any questions or suggestions for improvements
//TODO you will have to define the following:
// HX711_TIMER (the index of the timer, 2 for me)
// HX711_TIMER_INTERRUPT (the IRG for the timer, TIMER2_IRQn for me)
// Loadcell_Dout_Pin (the pin number for the HX711 data line)
// Loadcell_Sck_Pin (the pin number for the HX711 clock line)
#include "HX711.h"
#include "nrf_drv_gpiote.h"
// I don't dance now, I make muscle moves...
// Configurable Params
MaxMoveF = 4000
MaxHoldF = 1.334 * MaxMoveF
MaxTorque = 500
MaxHoldTorque = 1.334 * MaxTorque
MaxMoveSpeed = 4.5 // m/s
HillParamA = 0.25 // Coefficient of shortening heat in Hill's muscle model
SetAngularDrag(0)
To add as a Submodule in your git project
Open powershell in the "Assets" directory of your Unity project
Run git submodule add https://github.com/....
cd to the folder you cloned
Run git config core.sparseCheckout true
Open the file "..\..\.git\modules\...\info\sparse-checkout", perferably in vim
Add "Unity/Assets" to the file (or whatever you want to KEEP)
Make sure the file endings are Unix (in vim, you can run set ff=unix)
Save/close your text editor and run git checkout master