Skip to content

Instantly share code, notes, and snippets.

@ImanHz
ImanHz / pid.py
Last active April 30, 2025 09:37
A simple python code to simulate DC motor speed control with PID controller
import matplotlib.pyplot as plt
import numpy as np
# PID Controller Class
class PIDController:
def init(self, Kp, Ki, Kd, setpoint, integral, prev_error, err):
self.Kp = Kp
self.Ki = Ki
self.Kd = Kd
@ImanHz
ImanHz / esp32-create.sh
Last active July 18, 2025 18:26
Bash script to create and build an empty, ready to use ESP32 project.
#!/bin/bash
if [ -z $1 ]; then
echo "usage 'esp-create project_name [target]'"
exit
fi
echo "cleaning the existing project..."
rm -rf $1
@ImanHz
ImanHz / create-new-go-project.sh
Created January 18, 2024 08:13
Bash file to instantly create a new go project with module file and git
#!/bin/bash
if [ "$1" == "" ]; then
echo "define a project name"
exit
fi
echo "making the go project in $1"
mkdir $1
cd $1