Store in GIT

This commit is contained in:
2026-06-17 12:03:21 +02:00
parent da3dafa12f
commit 66ae70dcb2
31 changed files with 1898 additions and 0 deletions
+146
View File
@@ -0,0 +1,146 @@
/*
Verwarming.cpp
Copyright (c) 2014 Kenneth van Ewijk. All right reserved.
*/
// include this library's description file
#include "Verwarming.h"
#include "Arduino.h"
#include "Wire.h"
Verwarming::Verwarming(void)
{
// initialize this instance's variables
temp = 0;
wattage = 0;
state = false;
volume = 0;
led = 0;
}
//Set Heater Properties
void Verwarming::setTemp(double givenTemp)
{
temp = givenTemp;
}
void Verwarming::setState(bool givenState){
state = givenState;
}
void Verwarming::setWattage(int givenWattage){
wattage = givenWattage;
deltaTemp = (wattage / ( (volume * 1.293) * 1000) ) * 60;
}
void Verwarming::setVolume(int givenVolume){
volume = givenVolume;
deltaTemp = (wattage / ( (volume * 1.293) * 1000) ) * 60;
}
void Verwarming::setLed(int givenLed){
led = givenLed;
pinMode(led, OUTPUT);
}
//Calc Heater Properties
void Verwarming::toggleLed(void)
{
if(state){
analogWrite(led, 255);
}
else {
analogWrite(led, 0);
}
}
//Calc Heater Properties
double Verwarming::calcTemp(void)
{
if(state){
double newTemp = temp + deltaTemp;
return newTemp;
}
else {
return temp;
}
}
void Verwarming::keepTemp(double givenTemp)
{
if(temp >= givenTemp){
state = false;
}
else if(temp < givenTemp){
state = true;
}
toggleLed();
temp = calcTemp();
}
void Verwarming::gotoTemp(double givenTemp)
{
if(temp >= givenTemp){
state = false;
}
double newTemp = calcTemp();
if(newTemp <= givenTemp){
temp = newTemp;
}
else {
state = false;
}
toggleLed();
}
//Get Heater Properties
double Verwarming::getTemp(void)
{
return temp;
}
int Verwarming::getWattage(void)
{
return wattage;
}
bool Verwarming::getState(void){
return state;
}
double Verwarming::getDeltaTemp(void){
return deltaTemp;
}
int Verwarming::getTimeToTemp(double givenHeatFlow, double givenToTemp){
int timer = 0;
if(state){
double deltaTemp2 = givenToTemp - temp;
double neededHeat = (volume * 1.293) * 1000 * deltaTemp2;
double heatFlow = wattage - givenHeatFlow;
timer = neededHeat / heatFlow;
timer = timer / 60;
if(timer < 0){
timer = 0;
}
}
else{
timer = 0;
}
return timer;
}
+42
View File
@@ -0,0 +1,42 @@
/*
Verwarming.h
Copyright (c) 2014 Kenneth van Ewijk. All right reserved.
*/
// ensure this library description is only included once
#ifndef Verwarming_h
#define Verwarming_h
#include "Print.h"
#include <Wire.h>
// library interface description
class Verwarming
{
// user-accessible "public" interface
public:
Verwarming(void);
void setTemp(double);
void setState(bool);
void setWattage(int);
void setVolume(int);
void setLed(int);
double calcTemp(void);
void keepTemp(double);
void gotoTemp(double);
double getTemp(void);
int getWattage(void);
bool getState(void);
double getDeltaTemp(void);
int getTimeToTemp(double, double);
private:
void toggleLed(void);
double temp;
int wattage;
int volume;
bool state;
double deltaTemp;
int led;
};
#endif
@@ -0,0 +1,23 @@
#include <Verwarming.h>
// Library for "Verwarming"
// by Kenneth van Ewijk <http://www.kennyboy.nl>
// Demostrates how to do something with the Verwarming library
// Created 16 February 2014
Verwarming heater = Verwarming();
void setup()
{
heater.setTemp(20);
heater.setState(true);
}
void loop()
{
//Do stuff with heater
}
+18
View File
@@ -0,0 +1,18 @@
Verwarming KEYWORD1
setTemp KEYWORD2
setState KEYWORD2
setWattage KEYWORD2
setVolume KEYWORD2
setLed KEYWORD2
calcTemp KEYWORD2
toggleLed KEYWORD2
keepTemp KEYWORD2
gotoTemp KEYWORD2
getTemp KEYWORD2
getWattage KEYWORD2
getState KEYWORD2
getDeltaTemp KEYWORD2
getTimeToTemp KEYWORD2
+39
View File
@@ -0,0 +1,39 @@
This is an example C++ library for Arduino 0004+, based on one created by
Nicholas Zambetti for Wiring 0006+
Installation
--------------------------------------------------------------------------------
To install this library, just place this entire folder as a subfolder in your
Arduino/lib/targets/libraries folder.
When installed, this library should look like:
Arduino/lib/targets/libraries/Test (this library's folder)
Arduino/lib/targets/libraries/Test/Test.cpp (the library implementation file)
Arduino/lib/targets/libraries/Test/Test.h (the library description file)
Arduino/lib/targets/libraries/Test/keywords.txt (the syntax coloring file)
Arduino/lib/targets/libraries/Test/examples (the examples in the "open" menu)
Arduino/lib/targets/libraries/Test/readme.txt (this file)
Building
--------------------------------------------------------------------------------
After this library is installed, you just have to start the Arduino application.
You may see a few warning messages as it's built.
To use this library in a sketch, go to the Sketch | Import Library menu and
select Test. This will add a corresponding line to the top of your sketch:
#include <Test.h>
To stop using this library, delete that line from your sketch.
Geeky information:
After a successful build of this library, a new file named "Test.o" will appear
in "Arduino/lib/targets/libraries/Test". This file is the built/compiled library
code.
If you choose to modify the code for this library (i.e. "Test.cpp" or "Test.h"),
then you must first 'unbuild' this library by deleting the "Test.o" file. The
new "Test.o" with your code will appear after the next press of "verify"