Skip to content

Instantly share code, notes, and snippets.

View cyfinfaza's full-sized avatar

Cy cyfinfaza

View GitHub Profile
@cyfinfaza
cyfinfaza / something.py
Last active December 14, 2020 01:07
something
from math import *
@cyfinfaza
cyfinfaza / velocity.py
Created December 14, 2020 01:08
velocity
import math
while True:
mass = float(input("Mass: "))
temp = float(input("Temp (C): "))+273
print(str(math.sqrt(temp*2/mass)))
@cyfinfaza
cyfinfaza / cy.py
Last active March 21, 2021 01:47
c-y
messagesFile = open("messages.py", "r")
@cyfinfaza
cyfinfaza / image.py
Last active July 26, 2021 19:09
image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img = mpimg.imread('your_image.png')
imgplot = plt.imshow(img)
plt.show()
@cyfinfaza
cyfinfaza / TileController.py
Created July 11, 2024 20:30
SIL MagTile Python API (made using Claude 3.5 Sonnet)
import serial
import time
class TileController:
def __init__(self, port, baudrate=115200, timeout=1):
self.ser = serial.Serial(port, baudrate, timeout=timeout)
time.sleep(1) # Wait for Arduino to reset
self._clear_initial_message() # Clear the "Command Line Terminal Ready" message
self.scan_addresses() # Perform initial scan
@cyfinfaza
cyfinfaza / MagTilePython-Test2.py
Last active July 17, 2024 21:10
MagTilePython script to turn on all coils in snaking pattern (Claude 3.5 Sonnet)
from TileController import TileController
import time
import signal
import sys
# Global variable to store the controller
controller = None
def signal_handler(sig, frame):
print('\nKeyboard interrupt received. Cleaning up...')
@cyfinfaza
cyfinfaza / MagTilePython-Test1.py
Created July 11, 2024 20:34
MagTilePython script to do a few tests and blinkall
import TileController
with TileController.TileController("/dev/tty.usbmodem101") as tc:
print(tc.read_width())
print(tc.read_height())
print(tc.read_address_list())
print(tc.scan_addresses())
tc.blinkall_start()
input("Press Enter to stop blinking")
@cyfinfaza
cyfinfaza / SIL_MagTile_V1.ino
Last active July 17, 2024 21:11
SIL MagTile Arduino Firmware
#include <Arduino.h>
#include <Wire.h>
#include <EEPROM.h>
#define MAX_ADDRESSES 32
#define MAX_ROWS 6
#define MAX_COLUMNS 6
#define POWER_ARRAY_ROWS (MAX_ROWS * 3)
#define POWER_ARRAY_COLUMNS (MAX_COLUMNS * 3)
from TileController import TileController
import time
import signal
import sys
# Global variable to store the controller
controller = None
def signal_handler(sig, frame):
print('\nKeyboard interrupt received. Cleaning up...')