# Arduino as load cell amplifier x 2

Hi
I would like to read a total of 2 analog inputs on a Due board. I have been using the following code that works well with 1 analog input. How can I modify it to read 2 analog inputs and display the outputs at the serial port.

// Arduino as load cell amplifier
// by Christian Liljedahl
// christian.liljedahl.dk

// Load cells are linear. So once you have established two data pairs, you can interpolate the rest.

// You need two loads of well know weight. In this example A = 10 kg. B = 30 kg
// read the analog value showing (this is analogvalA)
// read the analog value B

// Enter you own analog values here
float loadA = 2.9; // kg

float loadB = 69.1; // kg

float analogValueAverage = 0;

// How often do we do readings?

int timeBetweenReadings = 200; // We want a reading every 200 ms;

void setup() {
Serial.begin(9600);
}

void loop() {

// running average - We smooth the readings a little bit
analogValueAverage = 0.99analogValueAverage + 0.01analogValue;

// Is it time to print?

}

// using a custom map-function, because the standard arduino map function only uses int
}
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

..declare new variables at top.. (guess u get the picture)

,,part of prog

`````` int analogValue0 = analogRead(0);

// running average - We smooth the readings a little bit
analogValueAverage0 = 0.99*analogValueAverage0 + 0.01*analogValue0;
analogValueAverage1 = 0.99*analogValueAverage1 + 0.01*analogValue1;

// Is it time to print?

Serial.print("   ");
``````

Thank you so much NY that works a treat and now I get 2 streams of numbers.

Could I ask more of your expertise if you can help. This is the code I am using in visual basic to read the single stream for display but now I have the extra stream to read I am not sure how to deal with it?

Thank you once again for your help it was Invaluable. Kind Regards Nevjc.

Delegate Sub myMethodDelegate(ByVal

This is NOT my "cup of the"..

``````Sub ProcessReading(input As String)
If IsNumeric(input) Then
temperature = CDbl(input)
picTherm.Refresh()
End If
End Sub
``````

must be changed.
i guess to sometling like this. (this is NOT good code, but shows yuo what I think..

``````Sub ProcessReading(input As String)
var part0 = input.substring(1,5);    //to get hold og the 1st part
var part1 = input.substring(6);    //the rest of sentence, to get hold og the 2nd part
If IsNumeric(part0) Then
temperature = CDbl(part0)
picTherm.Refresh()
End If
If IsNumeric(part1) Then
temperature1 = CDbl(part1)
picTherm.Refresh()
End If
End Sub
``````

Thank you again NY I will give it a try.

Regards Nevjc