Skip to content

Instantly share code, notes, and snippets.

View seanboe's full-sized avatar
📚
Studying

Sean Boerhout seanboe

📚
Studying
View GitHub Profile
import serial
import serial.tools.list_ports
def establishPort(port=None):
if port:
pdb_port = port
else:
available_ports = list(serial.tools.list_ports.comports())
for port in available_ports:
if "ItsyBitsy M0 Express" in port.description:
void hlcReport() {
if (micros() - hlcReportPrevUpdate > HLC_REPORT_INTERVAL) {
char report[100];
sprintf(report, "[%lu,%s,%s,%s,%s]", millis(), String(batt1V, 3).c_str(), String(batt1Curr, 3).c_str(), String(batt2V, 3).c_str(), String(batt2Curr, 3).c_str());
Serial.write(report);
memset(report, 0, sizeof(buffer));
}
}
if (batt1On && batt1V < BATT_EMPTY && batt2Installed && !batt2On) {
ISR_Override = true;
digitalWrite(BATT_2_CTL, HIGH);
batt2On = true;
prevSwitchTime = micros();
Serial.println("Switched to batt 2!");
buffer += "Switching to batt 2";
if (batt2V > BATT_EMPTY) {
digitalWrite(BATT_1_CTL, LOW);
batt1On = false;
@seanboe
seanboe / index.html
Created May 19, 2023 02:53
Stats project counter!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://kit.fontawesome.com/9f3da960b8.js" crossorigin="anonymous"></script>
One True
public class StudentClass{
public static void oneTrue(boolean[] myBools){
//enter line of code to set last position/element to true//
myBools[myBools.length - 1] = true;
@seanboe
seanboe / runner.java
Created January 4, 2023 07:26
Sorting Algorithms homework
public class runner {
public static void main(String[] args) {
// Create an array of length 50
int[] arr = new int[9000];
// Fill arr with random numbers in the range 0-99:
for (int x = 0; x < arr.length; x++) {
arr[x] = (int)(Math.random() * 100);
}
// ******************************************************
// An example of the SimpleFusion library that combines
// accelerometer and gyroscope data quickly and easily.
//
// This example uses the mpu6050 6-dof IMU and the
// Adafruit library for it.
//
// Created in 2022 by Sean Boerhout under the MIT License
// ******************************************************
// ******************************************************
// An example of the SimpleFusion library that combines
// accelerometer and gyroscope data quickly and easily.
//
// This example uses the mpu6050 6-dof IMU and the
// Adafruit library for it.
//
// Created in 2022 by Sean Boerhout under the MIT License
// ******************************************************
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
// #include <Adafruit_SSD1306.h>
#include <Adafruit_ST7735.h>
#include "PinChangeInterrupt.h"
#include <StopWatch.h>

Setting up the pic24 development board + software stuff

  1. Download MPLab X IDE
  2. Open MPLab X IDE, and if you don't have a compiler, close it. Otherwise, select your compiler.
  3. Download a c compiler from here. Since the PIC24 is a 16-bit board, install the XC16 compiler. Documentation for included libraries can be found here
  4. Open the compiler image and follow the setup instructions for MPLab XC Compiler.
  5. Once the compiler is finished installing, open MPLab X IDE again - if got a prompt earlier about not having a compiler, you shouldn't get that anymore
  6. Create a new project, selecting "Standalone project" and the PIC24FJ128GA204 mpu. Then choose the correct compiler (it should eliminate wrong selections for you)
  7. Create a source file in the "Sourc