In: Computer Science
Hi there, I need mpx2100ap arduino code
do I need an amplifier to make this work ?
MPX2100ap
The MPX2100ap arduino code is for weight sensor. The exact amplifier designed for this code are HX711.
However you can also compile this arduino code in online. There was lot of online arduino code compilers are available.
Arduino code for MPX2100ap
Step 1:
upload the sketch to your arduino board.
step 2 :
Entering anolog values
Float loadx = 20; //(in terms of kg)
int analogvalx = 400; // (analog reading taken with load x)
Float loady = 40; //(in terms of kg)
int analogvaly = 600; // (analog reading taken with load y)
float analog_Value_Average = 0;
int time_between_reading = 200 (interms of ms)
void setup()
{
serial.begin(9600);
}
Void loop()
{
int analog_value = analog_Read(0);
// to check time to print
if(millis() > time + time_between_readings)
float analog_To_Load(float analog_val){
// custom map-function used
float load = mapfloat(analog_val, analogvalx, analogvaly, loadx,
loadb);
return load;
}
float mapfloat(float a, float in_min, float in_max, float
out_min, float out_max)
{
return (a - in_min) * (out_max - out_min) / (in_max - in_min) +
out_min;
}
{
float load = analog_TO_load(analog_value_average);
serial.print("analog_values :"P);
serial.println(analog_value_average);
serial.print(" load:");
serial.println(load5);
time = millis();
}
}