Skip to content

Instantly share code, notes, and snippets.

@jschoch
jschoch / for 0-5module 30PA.py
Last active August 2, 2021 19:11
A cadquery model of a shaper cutting a gear, should allow you to simulate how a tool geometry will behave
import cadquery as cq
import math
pitch_diameter = 12
blank_diameter = 12.995
depth = 1.17
#indicates angle
gear_blank = (
@jschoch
jschoch / l510 rs485.iono
Last active April 20, 2021 19:54
basic teco l510 vfd modbus using esp32 and arduino via platform.io
#include <Arduino.h>
#include <ModbusMaster.h>
#include <HardwareSerial.h>
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <neotimer.h>
#include <SerialCommands.h>
// This defines ssid and password for the wifi configuration
@jschoch
jschoch / pendulum.ino
Last active March 27, 2021 18:12
simple foc pendulum
#include <Arduino.h>
#include <SimpleFOC.h>
#include <neotimer.h>
int led = 13;
int d = 200;
BLDCMotor motor = BLDCMotor(7);
BLDCDriver3PWM driver = BLDCDriver3PWM(25, 26, 27, 18);
//Pullup pullup = Pullup::INTERN;
@jschoch
jschoch / FOCals31313.cpp
Created December 10, 2020 19:02
simpleFOC als31313
#include "FOCals31313.h"
#define kNOERROR 0
#define kDATATOOLONGERROR 1
#define kRECEIVEDNACKONADDRESSERROR 2
#define kRECEIVEDNACKONDATAERROR 3
#define kOTHERERROR 4
int deviceAddress = 96;
MagneticSensorI2CConfig_s ALS31313_I2C_CONFIG = {
@jschoch
jschoch / haptic_lever.ino
Created December 4, 2020 22:12
haptic detent with simpleFOC
// Open loop motor control example for L298N board
#include <SimpleFOC.h>
#include <neotimer.h>
#define IN1 14
#define IN2 12
#define IN3 13
//#define IN4 8
// BLDC motor & driver instance
@jschoch
jschoch / machine.h
Created August 27, 2020 03:59
step signals leaking
18LTS schoch@xeon:/mnt/c/Users/jesse/Documents/Arduino/i2s_grbl/Grbl_Esp32/Grbl_Esp32/src/Machines$ cat jesse_6pack.h
#pragma once
// clang-format off
/*
6_pack_stepstick_v1.h
Covers all V1 versions V1p0, V1p1, etc
Part of Grbl_ESP32
@jschoch
jschoch / diff vs master
Last active August 10, 2020 21:08
debug stuff
18LTS schoch@xeon:/mnt/c/Users/jesse/Documents/Arduino/i2s_grbl/Grbl_Esp32/Grbl_Esp32$ git diff origin/master > diff.out
18LTS schoch@xeon:/mnt/c/Users/jesse/Documents/Arduino/i2s_grbl/Grbl_Esp32/Grbl_Esp32$ cat diff.out
diff --git a/Grbl_Esp32/config.h b/Grbl_Esp32/config.h
index e50f210..239c565 100644
--- a/Grbl_Esp32/config.h
+++ b/Grbl_Esp32/config.h
@@ -114,19 +114,19 @@ Some features should not be changed. See notes below.
//CONFIGURE_EYECATCH_BEGIN (DO NOT MODIFY THIS LINE)
#define ENABLE_BLUETOOTH // enable bluetooth
#include<Servo.h>
#include <wiring_pulse.h>
static uint32_t PWM_in = PA0;
int servoPin = PA1;
int TACH_PIN = PA9;
@jschoch
jschoch / clock.ino
Created November 6, 2019 21:43
clock
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 9
Adafruit_SSD1306 display(OLED_RESET);
#include <Encoder.h>
#include <DS3231M.h>
/*
* Example source code for an Arduino to show
* how to communicate with an Allegro ALS31300
*
* Written by K. Robert Bate, Allegro MicroSystems, LLC.
*
* ALS31300Demo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/