Skip to content

Instantly share code, notes, and snippets.

View daniel-frenkel's full-sized avatar

Daniel Frenkel daniel-frenkel

View GitHub Profile
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
int LED = 5;
// You should get Auth Token in the Blynk App.
@daniel-frenkel
daniel-frenkel / alexa_skill.json
Last active January 5, 2019 03:43
Alexa Skill JSON
{
"interactionModel": {
"languageModel": {
"invocationName": "morning rod",
"intents": [
{
"name": "AMAZON.FallbackIntent",
"samples": []
},
{
@daniel-frenkel
daniel-frenkel / lambda.js
Created January 5, 2019 04:22
Lambda Code
const http = require('http');
exports.handler = async (event, context, callback) => {
console.log(event.request.intent)
if (event.request.intent.slots.OnOff.value == "on") {
var responseJson = {
version: "1.0",
response: {
outputSpeech:
@daniel-frenkel
daniel-frenkel / motor_control.h
Last active October 23, 2019 20:20
motor_control.h
/* The MorningRod uses an ESP32 and TMC5130 motor driver
The datasheet for the TMC can be found here:
https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC5130_datasheet_Rev1.15.pdf
The TMC works by having the ESP manipulate bits in the motor driver.
The TMC is not an ordinary driver, it is a ver smart Motion Controller.
It can function completely on its own. All the ESP does is set bits to change the properties of the ESP.
It is very simple to do, here is how:
#define USE_CUSTOM_BOARD // See "Custom board configuration" in Settings.h
#define APP_DEBUG // Comment this out to disable debug prints
#define MOVE_DISTANCE preferences.getFloat("move_distance", 0)
#define MOVE_PERCENT preferences.getFloat("move_percent", 389911.13)
#define BLYNK_PRINT Serial
#include "driver/ledc.h"
#include "BlynkProvisioning.h"
#include <PubSubClient.h>
#include <SPI.h>
@daniel-frenkel
daniel-frenkel / ESPHome.YAML
Last active November 14, 2022 17:49
ESPHome YAML File
substitutions:
device_name: edit-name
pulley_diameter_mm: "15" # 1 turn about 47 mm
gear_ratio: "1" # not used yet for simplicity
distance_mm: "500" # about 10 turns
acceleration: 12800 steps/s^2
velocity: 12800 steps/s # 1 turn per second
open_current: 500ma
open_stall_threshold: "20"
close_current: 600ma