Skip to content

Instantly share code, notes, and snippets.

View AndiSHFR's full-sized avatar
💭
Designing and Coding...

Andreas Schaefer AndiSHFR

💭
Designing and Coding...
View GitHub Profile
@AndiSHFR
AndiSHFR / HumanReadableDuration.c
Last active May 3, 2019 13:15
Converts a duration in seconds into a human readable string.
/**
* HumanReadableDuration
*
* Retruns a human readable duration for totalSeconds.
* Make sure outputBuffer is big enough to hold the
* complete string incl. temrinate '\0' character.
*/
char* HumanReadableDuration(unsigned long totalSeconds, char* outputBuffer ) {
if(outputBuffer) {
@AndiSHFR
AndiSHFR / GetOnboardTemperature.c
Last active May 3, 2019 13:16
Read internal ATmega cpu temperature sensor.
/**
* GetOnboardTemperature
*
* Read temperature from the onbaord sensor. Check specs if sensor exist for your cpu. ;-)
*
* Example:
* char buff[10];
* Serial.print("CPU temp.: " );
* Serial.print(dtostrf(GetOnboardTemperature(), 5, 2, buff));
/**
* PulseHeartbeat
*
* Blink the onboard LED to signal "Yepp, we are still runnning".
* The onbaord LED is on pin 13 and so pin 13 will be set to OUTPUT.
*
* Call this at the beginning of your loop() function.
* Caution: Will only work if millis() if functional and no one else
* did hook up timer0.
*/
@AndiSHFR
AndiSHFR / CalculateUptimeSeconds.c
Created March 20, 2016 13:54
Calculate uptime in seconds on adruino from millis().
/**
* CalculateUptimeSeconds()
*
* Handle millis() rollover and calculate the total uptime in seconds.
* This function must be called at least once for every 50 days to be
* able to see the rollover.
*/
unsigned long CalculateUptimeSeconds(void) {
static unsigned int _rolloverCount = 0; // Number of 0xFFFFFFFF rollover we had in millis()
@AndiSHFR
AndiSHFR / ReadPlantiTMva.vbs
Last active December 13, 2023 11:43
Visual Basic Script to read measure value data from a ProLeiT Plant iT System.
' This visual basic script is a very basic example
' how to retrieve measure values from a ProLeiT plant it system.
'
' It will create a csv style output for all measure
' datapoints with the latest timestamp of data and value.
'
' Before running this script you need to change the username,
' password, database server/instance and database to
' point at your system.
'