Skip to content

Instantly share code, notes, and snippets.

View jasonhejna's full-sized avatar

Jason Hejna jasonhejna

View GitHub Profile
@jasonhejna
jasonhejna / ximea_camera.py
Created February 13, 2024 15:47
ximea_camera.py
from ximea import xiapi
import time
#create instance for first connected camera
cam = xiapi.Camera()
#start communication
#to open specific device, use:
#cam.open_device_by_SN('41305651')
#(open by serial number)
@jasonhejna
jasonhejna / gist:974f3de54d742168fdcedf9ad0155503
Last active February 2, 2024 20:54
camera_capture_test.py
import cv2
import os
import time
def main():
# Camera settings
width, height, fps = 640, 360, 260
frame_count_to_capture = fps # Number of frames for 1 second
temp_image_folder = "temp_images"
os.makedirs(temp_image_folder, exist_ok=True)
#!/bin/bash
# File to store the CPU temperature logs
LOG_FILE="cpu_temp_log.csv"
# Function to get CPU temperature
get_cpu_temp() {
# Using sensors command to get CPU temp from the specified sensor
sensors | grep 'temp1:' | awk '{print $2}' | tr -d '+C'
}
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
// screen lib setup
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/U8X8_PIN_NONE, /* clock=*/SCL, /* data=*/SDA); // pin remapping with ESP8266 HW I2C
#define boost_en 13
#define L1F A4
#define L2F A5
/*
Digalog
{"relay1":0,"relay2":1,"UUID":"tornado-airplane","pot1":[80,985],"pot2":[50,353],"pot3":[50]}
*/
#include <ArduinoJson.h>
#include <FlashStorage_SAMD.h>
// UUID placeholder
String UUID = "tornado-airplane";
// Tyler's Lamp
#include <Adafruit_DotStar.h>
#include <SPI.h>
#define NUMPIXELS 62 // Number of LEDs in strip
// Here's how to control the LEDs from any two pins:
#define DATAPIN 6
#define CLOCKPIN 2
// LAMP 198
#include <Adafruit_DotStar.h>
#include <SPI.h>
#define NUMPIXELS 60 // Number of LEDs in strip
// Here's how to control the LEDs from any two pins:
#define DATAPIN 2
#define CLOCKPIN 6
// Simple strand test for Adafruit Dot Star RGB LED strip.
// This is a basic diagnostic tool, NOT a graphics demo...helps confirm
// correct wiring and tests each pixel's ability to display red, green
// and blue and to forward data down the line. By limiting the number
// and color of LEDs, it's reasonably safe to power a couple meters off
// the Arduino's 5V pin. DON'T try that with other code!
#include <Adafruit_DotStar.h>
// Because conditional #includes don't work w/Arduino sketches...
#include <SPI.h>
// Simple strand test for Adafruit Dot Star RGB LED strip.
// This is a basic diagnostic tool, NOT a graphics demo...helps confirm
// correct wiring and tests each pixel's ability to display red, green
// and blue and to forward data down the line. By limiting the number
// and color of LEDs, it's reasonably safe to power a couple meters off
// the Arduino's 5V pin. DON'T try that with other code!
#include <Adafruit_DotStar.h>
// Because conditional #includes don't work w/Arduino sketches...
#include <SPI.h> // COMMENT OUT THIS LINE FOR GEMMA OR TRINKET
@jasonhejna
jasonhejna / curtain.ino
Last active June 28, 2019 22:35
Robotic Curtain Control
// Stage Curtain Control System
//
// A Hall Effect Sensor is used to count the rotations of the drive motor. Two relays are used to power the motor on in either direction.
// Input is provided by an Up, and Down button operating on 12v DC.
// Input may be added later using WiFi, or Schedules.
//
// Author: Jason Hejna (jason.hejna@gmail.com)
// Author: Mukesh Ramani
//void count_motor_rotation(void);