Skip to content

Instantly share code, notes, and snippets.

View ArminJo's full-sized avatar
🏠
Working at home

Armin ArminJo

🏠
Working at home
  • Cologne
View GitHub Profile
@ArminJo
ArminJo / HexDump.cpp
Last active October 21, 2022 15:32
Hex memory dump utility functions for Arduino. 0x00 and 0xFF are printed as spaces.
/*
* HexDump.cpp
* Hex memory dump utility functions for Arduino. 0x00 and 0xFF are printed as spaces.
*
* Sample output:
* 0x0000: 0xF1 0x81 0x82 0x00 0x08 0x02 0x00 0x27 0xFF 0xFF 0x0E 0xB3 0x81 0xFC 0x9B 0x47 ... .. ' .....G
* 0x0020: 0x00 0x00 0x00 0x00 0x20 0x65 0x00 0x0F 0xBE 0xEB 0x9B 0x98 0x2C 0xF1 0x08 0x2C e .....,..,
*
* Copyright (C) 2022 Armin Joachimsmeyer
* Email: armin.joachimsmeyer@gmail.com
@ArminJo
ArminJo / RobotArmKinematics.cpp
Last active May 24, 2022 08:12
Kinematics functions for the meArm robot arm
/*
RobotArmKinematics.cpp
Contains the kinematics functions for the meArm robot arm
See also: https://www.instructables.com/id/4-DOF-Mechanical-Arm-Robot-Controlled-by-Arduino
Servo trims are chosen, so that 0°, 0°, 0° (left/right, back/front, up/down) results in the neutral position of the robot arm.
Neutral means: pivot direction forward, and both arms rectangular up and forward
Neutral position: X=0
Y=(LIFT_ARM_LENGTH_MILLIMETER + CLAW_LENGTH_MILLIMETER) - Here claw length is from wrist to hand PLUS base center to shoulder
@ArminJo
ArminJo / 433MHzSenderPT2262.cpp
Created September 12, 2020 09:17
Arduino 433 MHz sender for PT2262/PT2272 sender/receiver chip combinations.
/*
* 433MHzSenderPT2262.cpp
*
* 433 MHz sender for PT2262/PT2272 sender/receiver chip combinations.
* https://cdn-shop.adafruit.com/datasheets/PT2262.pdf
*
* Copyright (C) 2020 Armin Joachimsmeyer
* armin.joachimsmeyer@gmail.com
*
* 433MHzSenderPT2262 is free software: you can redistribute it and/or modify
@ArminJo
ArminJo / RFProtocols.cpp
Created September 2, 2020 08:05
3 protocols for RF remote controls for Arduino. 2262 / 2272 + EIM-826 + Intertechno
#include <Arduino.h>
#include <digitalWriteFast.h>
/*
* HX2262/2272 Stuff
*/
// measured 33.91 kHz receiver clock => Data sheet says: Transmitter clock has to be 2.5 to 8 times slower
// https://cdn-shop.adafruit.com/datasheets/PT2262.pdf
//const int HX2272_FUNDAMENTAL_CLOCK_PERIOD_X4_MICROS = 118;
const int HX2272_FUNDAMENTAL_CLOCK_PERIOD_X4_MICROS = 440;
@ArminJo
ArminJo / bresenhamThickLine.cpp
Last active March 30, 2023 20:15
Draw a solid line with thickness using a modified Bresenhams algorithm.
/*
* Overlap means drawing additional pixel when changing minor direction
* Needed for drawThickLine, otherwise some pixels will be missing in the thick line
*/
#define LINE_OVERLAP_NONE 0 // No line overlap, like in standard Bresenham
#define LINE_OVERLAP_MAJOR 0x01 // Overlap - first go major then minor direction. Pixel is drawn as extension after actual line
#define LINE_OVERLAP_MINOR 0x02 // Overlap - first go minor then major direction. Pixel is drawn as extension before next line
#define LINE_OVERLAP_BOTH 0x03 // Overlap - both
#define LINE_THICKNESS_MIDDLE 0 // Start point is on the line at center of the thick line
@ArminJo
ArminJo / MillisUtils.cpp
Last active September 2, 2020 08:14
Arduino millis() disable, enable and compensation
#include <Arduino.h>
// See: https://github.com/ArminJo/Arduino-Utils/blob/master/src/MillisUtils.cpp
/*
* storage for millis value to enable compensation for interrupt disable at signal acquisition etc.
*/
#if ( defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) )
#define timer0_millis millis_timer_millis // The ATTinyCore libraries use other variable name in wiring.c
#endif
#if defined(TIMSK) && !defined(TIMSK0) // some ATtinys
#define TIMSK0 TIMSK