Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed HX711 BME280
main.cpp
- Committer:
- mathis_v
- Date:
- 2020-03-05
- Revision:
- 0:b513811affc9
- Child:
- 1:dc5547452d12
File content as of revision 0:b513811affc9:
#include "mbed.h" #include "HX711.h" /* définition des constantes pour les jauges*/ #define PINSCK A5 #define CAL_FACT1 -57.8 #define CAL_FACT2 -57.8 #define CAL_FACT3 -57.8 #define CAL_FACT4 -57.8 #define AVG_SAMPLE 100 Serial pc(USBTX, USBRX); /*Liaison série avec le pc*/ HX711 s1(A1,PINSCK),s2(A2,PINSCK),s3(A3,PINSCK),s4(A4,PINSCK); /*déclaration des 4 jauges*/ void print_4jauges(); //------------------------------------------------ DigitalOut myled(LED1); //------------------------------------------------ int main() { /*ajustement des facteur de calibrations*/ s1.setScale(CAL_FACT1); //Adjust to this calibration factor s2.setScale(CAL_FACT2); //Adjust to this calibration factor s3.setScale(CAL_FACT3); //Adjust to this calibration factor s4.setScale(CAL_FACT4); //Adjust to this calibration factor s1.tare(); s2.tare(); s3.tare(); s4.tare(); while(1) { print_4jauges(); } } void print_4jauges(){ double weight1=0; double weight2=0; double weight3=0; double weight4=0; double total; weight1 = s1.getGram(); //pc.printf("j1= %.0f ",weight1); weight2 = s2.getGram(); //pc.printf("j2= %.0f\r\n ",weight2); weight3 = s3.getGram(); //pc.printf("j3= %.0f ",weight3); weight4 = s4.getGram(); //pc.printf("j4= %.0f ",weight4); total=weight1+weight2+weight3+weight4; //pc.printf("tt= %.0f \r\n",total); pc.printf("j1= %.0f j2= %.0f j3= %.0f j4= %.0f tt= %.0f \n \r", weight1,weight2,weight3,weight4,total); }