Skip to content

Instantly share code, notes, and snippets.

@jones2126
jones2126 / ttgo_cytron_pid_v1
Last active September 29, 2022 16:58
Testing program with PID to control the Cytron MD30
/*
* Calculate the error between current direction and the desired direction
* Use a MAP function to convert the error to a value 0-255
* Use that value to feed into a PID and use the output as the power level for the motor controller
*/
#include <Arduino.h>
/* Credit: https://www.youtube.com/channel/UCjiVhIvGmRZixSzupD0sS9Q
*
* Very hard left - 3492
@jones2126
jones2126 / structure_memcpy_test.ino
Created July 31, 2022 00:16
This was used to confirm the size of the structure and test using the memcpy function to copy from a structure to a buffer and then back again. This helped me clarify this concept would work in anticipation of including it in a LoRa radio master/slave setup.
/*
* This was used to confirm the size of the structure and test using the memcpy function to copy from a structure to a buffer and then back again.
* This helped me clarify this concept would work in anticipation of including it in a lora radio master/slave setup.
*/
struct RadioControlStruct{
int steering_val;
int throttle_val;
float press_norm ;
float press_hg;
float temp;
@jones2126
jones2126 / ttgo_adafruit_server.ino
Created July 7, 2022 16:07
Testing code for master/tractor/server to interact with slave/remote control/client using a TTGO board and LoRa communication. This code runs on the server which is meant to be the laptop on the tractor.
/*
* Program: ttgo_adafruit_server.ino
* a simple messaging server(sender)with the RH_RF95 class.
*/
#include <SPI.h>
#include <RH_RF95.h>
//#define RFM95_CS 2 // "E"
@jones2126
jones2126 / ttgo_adafruit_client_v2.ino
Last active July 8, 2022 01:54
Testing code for master/tractor/server to interact with slave/remote control/client using a TTGO board and LoRa communication. This code runs on the client which is meant to be a remote control module for the tractor/master.
/* Program: ttgo_adafruit_client_v2.ino
* a simple messaging client (receiver)with the RH_RF95 class.
*/
#include <SPI.h>
#include <RH_RF95.h>
//Libraries for OLED Display
#include <Wire.h>
#include <Adafruit_GFX.h>
@jones2126
jones2126 / ttgo_RH95_init.ino
Last active June 24, 2022 01:41
TTGO Semtech SX1276 ESP32 LoRa board using Radio Head RH_RF95. This program is used to test getting the LoRa service to initialize.
/*
ttgo_RH_RF95_init This program is used to test getting the LoRa service to initialize on a TTGO ESP32 LoRa board
ref: https://microcontrollerslab.com/ttgo-lora32-sx1276-oled-board-pinout-getting-started-with-arduino-ide/
*/
#include <SPI.h>
#include <RH_RF95.h>
#include <RHReliableDatagram.h>
// LoRa pins for TTGO Semtech SX1276
#define LORA_MISO 19
@jones2126
jones2126 / steer_base_test.ino
Created March 3, 2022 17:07
Test program for a MAP function aimed at testing code for a steering module that will be used to turn a steering servo from hard left to hard right based on the steering angle provided which will generally be between .82 and -.76 which has to be mapped to a range of -14,000 and 13,500 which are the values from the steering angle sensor.
/*
Test program for a MAP function aimed at testing code for a steering module that will be used to turn a steering servo from hard left to hard right
based on the steering angle provided which will generally be between .82 and -.76 which has to be mapped to a range of -14,000 and 13,500 which are
the values from the steering angle sensor.
I initially tested this on an Arduino Nano Every board
if(angular_vel_z > 0)
{
steering_angle_target = angular_vel_z*(steer_left_max - steer_straight) / 1+steer_straight;
@jones2126
jones2126 / map_function_test.ino
Last active December 4, 2021 17:50
Test code for MAP function to be integrated into steering control module
/*
Test program for a MAP function aimed at testing code for a steering module that will be used to turn a steering servo from hard left to hard right
based on the steering angle provided which will generally be between .82 and -.76 which has to be mapped to a range of -14,000 and 13,500 which are
the values from the steering angle sensor.
*/
#include <Arduino.h>
// steering value constants
const int steer_straight = 1;
@jones2126
jones2126 / transmission_v3.cpp
Last active November 14, 2021 20:01
Super Servo ROS enabled and control the transmission of a lawn tractor
/*
This program is designed to run on a Teensy that is connected to a SuperServo to make the Super Servo ROS enabled and control
the transmission of a lawn tractor. It is started in a launch file as one of multiple nodes with the command:
<node ns="transmission_teensy" name="transmission_cntrl" pkg="rosserial_python" type="serial_node.py" args="/dev/transmission_control" output="screen" />
Overview:
subscribe to a target speed in cmd_vel format (i.e. cmd_vel.linear.x)
subscribe to actual speed from the rear wheels
adjust servo position to match actual speed to target speed
@jones2126
jones2126 / notes.txt
Created October 25, 2021 00:12
Soontech RX 580 ellesmere 8gb not mining with ethminer using ethos; Receiving the error "Creating DAG buffer failed: clCreateBuffer: CL_INVALID_BUFFER_SIZE (-61)"
Similar posts https://github.com/ethereum-mining/ethminer/issues/1966
What is not clear is the fix. There is a mention, "You can continue using ethminer if you can build the binary on your own
See instructions here https://github.com/ethereum-mining/ethminer#build"
Download ethminer-0.18.0-cuda-8-linux-x86_64.tar.gz
Are these correct? (from: https://github.com/ethereum-mining/ethminer/blob/master/docs/BUILD.md)
$ sudo apt install libdbus-1-dev
$ sudo apt-get install mesa-common-dev
@jones2126
jones2126 / ROS_GUI_v7.py
Created August 21, 2021 23:09
Python Tkinter script to help start launch files from my laptop and to start windows that show the values of ros topics.
#!/usr/bin/env python
#
import tkinter as tk
from tkinter import ttk
import subprocess
import time
'''
issues:
- speed up the login process by looking for the $ which shows the login has completed