I have run the code and it does seem to be running feaster which is good.
However I just seem to be getting the same output even if I put weights on the load cell. It cycles through these.
M: |
20 |
G: |
10732 |
M: |
16 |
G: |
10756 |
M: |
20 |
G: |
10732 |
M: |
16 |
G: |
10756 |
M: |
20 |
I have added the rest of the measurement data to the code below:
#include "HX711.h"
#include <MultiMap.h>
HX711 scale;
float sharp(float G);
float out[] = {0,10,20,30,40,50,60,70,80,90,100,150,200,250,300,400,500,600,700,800,900,1000,1200,1400,1600,1800,2000,2500,3000,3500,4000};
float in[] = {58458.33333,62220.33333,66053,69057.66667,71834,75096.33333,78006.66667,81054.33333,83915.66667,87138.33333,89430.33333,104678.6667,120613,134464.3333,149991.6667,181428.3333,211653.3333,243324.3333,273871.3333,303086,336010.6667,366756.3333,429986,490740,558840.6667,617843.6667,673671.3333,828331,986758.3333,1140857.667,1293730.333 };
void setup()
{
Serial.begin(115200); // <<<<<<<<<<<<<<<<<
Serial.println(__FILE__);
scale.begin(9, 10);
scale.tare();
}
void loop()
{
uint32_t start = micros();
float G = scale.get_units(1);
uint32_t stop = micros();
Serial.print("G:\t");
Serial.println(stop - start);
start = micros();
float M = multiMap<float>(G, in, out, 3);
stop = micros();
Serial.print("M:\t");
Serial.println(stop - start);
}
I will have another look at the MultiMap and the HX711_MP libraries as I don't think I have understood them properly.
Thanks again for your help. 