Skip to content

Instantly share code, notes, and snippets.

The heating element will begin to coast upon nearing the target temperature, but what kind of control must there be over this coasting? PID (an algorithm that smoothes out the approach to any target value) would be one way to prevent overshooting, but it employs PWM (rapidly switching on/off) which drastically reduces a relay's life cycle :( The simple solution? Just calculate the time between turning off the heat and achieving a temperature 'apex.' Hard-code this time period into the relay control.
@svensken
svensken / dlllauschen.cpp
Created May 16, 2011 03:44
library bridges
/*
compile with Visual Studio C++ command prompt using:
cl -LD dlllauschen.cpp -Felauschen.dll
*/
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "hidapi.h"
#pragma comment(lib, "hidapi.lib")
@svensken
svensken / HardwareProfile.h
Created March 20, 2011 20:11
Hier geht es nicht um Eleganz ;)
#ifndef HARDWARE_PROFILE_H
#define HARDWARE_PROFILE_H
// Defines required for the USB stack
//#define PROGRAMMABLE_WITH_USB_HID_BOOTLOADER
#define self_power 1
/*#define USE_SELF_POWER_SENSE_IO
#define tris_self_power TRISBbits.TRISB0 // Input
#define self_power RB0*/