Skip to content

Instantly share code, notes, and snippets.

@atotto
atotto / apriltag_video_capture.py
Last active May 5, 2021
apriltag video capture example
View apriltag_video_capture.py
# https://github.com/AprilRobotics/apriltag
# example image: https://github.com/AprilRobotics/apriltag-imgs/blob/master/tagStandard41h12/mosaic.png
import cv2
from apriltag import apriltag
cam = cv2.VideoCapture(0)
cv2.namedWindow("detections")
img_counter = 0
View m5-clock.ino
#include <M5Stack.h>
#include <WiFi.h>
#include "lwip/apps/sntp.h"
#define TFT_GREY 0x5AEB
const char *ssid = "ssid";
const char *password = "password";
View BleConnectionStatus.cpp
#include "BleConnectionStatus.h"
BleConnectionStatus::BleConnectionStatus(void) {
}
void BleConnectionStatus::onConnect(BLEServer* pServer)
{
this->connected = true;
BLE2902* desc = (BLE2902*)this->inputKeyboard->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
desc->setNotifications(true);
@atotto
atotto / init.el
Created Jul 2, 2020
simple golang editor setting for emacs
View init.el
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
View ttgo-t5-v2.3_battery.ino
#include <GxEPD2_BW.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#define EPD_CS SS
GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B73
#define BAT 35
@atotto
atotto / madgwickfilter_mpu9250.ino
Created Oct 7, 2019
madgwickfilter + MPU9250 IMU sensor
View madgwickfilter_mpu9250.ino
/*
VDD ---------- 3.3V
SDA ---------- A4
SCL ---------- A5
GND ---------- GND
*/
#include "MadgwickAHRS.h" // github.com/arduino-libraries/MadgwickAHRS
#include "MPU9250.h" // github.com/bolderflight/MPU9250
@atotto
atotto / 60-ublox-m8.rules
Created Sep 29, 2019
/etc/udev/rules.d/60-ublox-m8.rules
View 60-ublox-m8.rules
SUBSYSTEM!="tty", GOTO="ublox-m8_rules_end"
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a8", SYMLINK+="ublox-m8" MODE="0666"
LABEL="ublox-m8_rules_end"
View bind_to_device.go
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"os"
"syscall"
View esc.py
import time
import pigpio
motor_pin = 18 # GPIO18 (pin12)
pi = pigpio.pi()
pi.set_mode(motor_pin, pigpio.OUTPUT)
pi.set_servo_pulsewidth(motor_pin, 1300)
print("please power on ESC")
@atotto
atotto / ssh.go
Last active Apr 15, 2021
golang ssh terminal client
View ssh.go
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"