Author Topic: Digispark as MULTIMETER  (Read 3272 times)

jaghvi

  • Newbie
  • *
  • Posts: 29
Digispark as MULTIMETER
« on: August 27, 2013, 10:32:22 pm »
Received 2  Digispark yesterday . How about DS as multimeter ? Anyone who has implemented it ?

semicolo

  • Full Member
  • ***
  • Posts: 137
Re: Digispark as MULTIMETER
« Reply #1 on: September 01, 2013, 01:35:41 pm »
I did a quick voltage logger to eeprom some time ago, it should be fairly easy to display a voltage on a LCD screen.


digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Digispark as MULTIMETER
« Reply #2 on: September 01, 2013, 05:33:44 pm »
This should be very simple - and quite useful - for the voltage reading just


int reading = analogRead(PinNumber);
double result = doubleMap(reading,0,1024,0,5);


with this function to do the doubleMap since the map function is just for integers



double doubleMap(double x, double in_min, double in_max, double out_min, double out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}