Partage
  • Partager sur Facebook
  • Partager sur Twitter

programmation arduino

jauge de contrainte HX711

    25 mai 2019 à 12:02:04

    bonjour,
    je suis en première stl et j'ai comme projet de mesurer une masse avec une jauge de contrainte sur Arduino.
    J'ai trouver un programme et un montage sur internet qui me s'embler intéressant .je l'ai essayer ,j'arrive a compiler le programme puis a le téléverser mais je n'arrive pas a mesurer la masse  ….
    Je ne comprend pas pk pouvais vous m'aider stp !!!   
    mon code :
    #include "HX711.h"
    #define DOUT  3
    #define CLK  2
    HX711 scale;
    float calibration_factor = -1242; //-7050 worked for my 440lb max scale setup
    void setup() {
      Serial.begin(9600);
      Serial.println("HX711 calibration sketch");
      Serial.println("Remove all weight from scale");
      Serial.println("After readings begin, place known weight on scale");
      Serial.println("Press + or a to increase calibration factor");
      Serial.println("Press - or z to decrease calibration factor");
      scale.begin(DOUT, CLK);
      scale.set_scale();
      scale.tare(); //Reset the scale to 0
      long zero_factor = scale.read_average(); //Get a baseline reading
      Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects.
      Serial.println(zero_factor);
    }
    void loop() {
      scale.set_scale(calibration_factor); //Adjust to this calibration factor
      Serial.print("Reading: ");
      Serial.print(scale.get_units(), 1);
      Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person
      Serial.print(" calibration_factor: ");
      Serial.print(calibration_factor);
      Serial.println();
      if(Serial.available())
      {
        char temp = Serial.read();
        if(temp == '+' || temp == 'a')
          calibration_factor += 10;
        else if(temp == '-' || temp == 'z')
          calibration_factor -= 10;
      }
    }
    mon montage :
      [1]: https://i.stack.imgur.com/pzEjs.png
    • Partager sur Facebook
    • Partager sur Twitter

    programmation arduino

    × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
    × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
    • Editeur
    • Markdown