Skip to content

Instantly share code, notes, and snippets.

View enwi's full-sized avatar
👻

Moritz Wirger enwi

👻
View GitHub Profile
@enwi
enwi / Fire2018-2.ino
Last active December 20, 2020 22:47 — forked from StefanPetrick/Fire2018-2.ino
Fire effect v2.0 for FastLED matrix
#include "FastLED.h"
const uint8_t BRIGHTNESS = 255;
// matrix size
const uint8_t WIDTH = 16;
const uint8_t HEIGHT = 16;
const uint16_t NUM_
= WIDTH * HEIGHT;
// parameters and buffer for the noise array
@enwi
enwi / fan_control.py
Created October 28, 2017 17:00
Little pyhton script that will control a fan connected to a raspberry pi according to cpu and hdd temperature.
#!/usr/bin/python
import RPi.GPIO as GPIO
import os
import signal
import time
# Basic configuration
c_FAN = 26 # gpio pin the fan is connected to
c_FAN_TACHO = 19 # gpio pin the fan tachometer is connected to
c_MIN_TEMPERATURE = 45 # temperature in degrees c when fan should turn on
@enwi
enwi / inverterFanControl.ino
Created October 1, 2017 17:23
Arduino code for the fan control of the modified power inverter: https://youtu.be/2shofvjHGbU
#include <avr/sleep.h>
#include <avr/wdt.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Function Prototype for wdt_init (place it in init3 section, before main executes to prevent perma-resetting)
void wdt_init(void) __attribute__((naked)) __attribute__((section(".init3")));
void wdt_init(void)
{
@enwi
enwi / fan_control.sh
Last active November 17, 2019 13:55
Little shell script that reads the temperature of a raspberry pi cpu and a connected harddrive using smartctl and controls a GPIO pin where a fan should be connected.
#!/bin/bash
c_FAN=26 # gpio pin the fan is connected to
c_MIN_TEMPERATURE=45 # temperature in degrees c when fan should turn on
c_TEMPERATURE_OFFSET=2 # temperarute offset in degrees c when fan should turn off
c_HARDDRIVE="sda" # name of your harddrive
temperature_offset=$(( $c_MIN_TEMPERATURE - $c_TEMPERATURE_OFFSET ))
fan_state=0
@enwi
enwi / update.sh
Created August 6, 2017 13:39
Simple shell script that updates your linux. If you only want error messages then uncomment the comments in each line.
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[1;32m'
BLUE='\033[1;34m'
NC='\033[0m' # No Color
echo -e "${BLUE}System update${NC}"
sudo apt-get update #2>&1 >/dev/null
echo -e "${BLUE}System upgrade${NC}"
sudo apt-get upgrade -y #2>&1 >/dev/null