Skip to content

Instantly share code, notes, and snippets.

View JensGrabner's full-sized avatar
💭
in progress

Jens Grabner JensGrabner

💭
in progress
View GitHub Profile
@JensGrabner
JensGrabner / MCP3421_test.pde
Created July 29, 2017 07:13 — forked from 2N2222A/MCP3421_test.pde
Arduino voltmeter using an MCP3421 18 bit ∆-∑ ADC
/*
This revision includes the modified display output to the LCD
mcp adress = 0x68
sr= Sample Rate Selection
sr=0 ; 00 = 240 SPS (12 bits),
sr=1 ; 01 = 60 SPS (14 bits),
sr=2 ; 10 = 15 SPS (16 bits),
@JensGrabner
JensGrabner / How to use this class?
Created April 9, 2017 08:49 — forked from sklaw/How to use this class?
C++ Rational Number Class
You can use this class in the same way you use "int".
The following operators are available:
+ - * /
++ --
+= -= *= /=
< > <= >= == !=
<< >>
For example:
RationalNum a, b;
@JensGrabner
JensGrabner / sqrt.c
Created March 1, 2017 10:55 — forked from foobaz/sqrt.c
Integer square root algorithm
/*
Just like integer division, these functions round down to an integer.
Running this program should produce the following output:
sqrt(3735928559) == 61122
61122^2 == 3735898884
sqrt(244837814094590) == 15647294
15647294^2 == 244837809522436
This algorithm comes from Jack W. Crenshaw's 1998 article in Embedded:
@JensGrabner
JensGrabner / sample code to test sensor
Created September 6, 2016 07:19 — forked from Robotonics/sample code to test sensor
TCN75 Temp Sensor-Arduino
#include?"Wire.h"
#define?tcn75address?0x4F?// with pins 5~7 set to GND, the device address is 0x48
void setup()
{
??Wire.begin(); // wake up I2C bus
??Serial.begin(115200);
}
float tcn75_getTemperature(int address)
@JensGrabner
JensGrabner / calc.c
Created January 20, 2016 13:47 — forked from AnthonyDiGirolamo/calc.c
shunting yard algorithm in c
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define CHECKMALLOC(var) if((var) == NULL) {printf("ERROR: malloc\n");abort();}
#define MAXOPSTACK 64
#define MAXNUMSTACK 64