Giter VIP home page Giter VIP logo

Comments (2)

jpk73 avatar jpk73 commented on June 7, 2024

Also getSingleConversion() is missing...

from hx711_adc.

olkal avatar olkal commented on June 7, 2024

Hi, sorry for the delayed response...
getSingleConversionRaw() and getSingleConversion() was not working as intended and was therefore removed. I just forgot to remove them in the .h file, I will fix that.
If you need single conversion you can use samples = 1 in the config file.
Raw data conversion is not supported at the time, but you can try the code below.

//HX711 conversion, raw data

int doutPin = 2;
int sckPin = 3;

unsigned long conversionData;
unsigned long t;

unsigned long getConversionData() {
  unsigned long data = 0;
  byte dout;
  for (uint8_t i = 0; i < (24 + 1); i++) { //read 24 bit data + set gain and start next conversion
    delayMicroseconds(1);
    digitalWrite(sckPin, 1);
    delayMicroseconds(1);
    if (i < (24)) {
      dout = digitalRead(doutPin);
      data = data << 1;
      if (dout) {
        data++;
      }
    }
    digitalWrite(sckPin, 0);
  }
  data = data ^ 0x800000; // if out of range (min), change to 0
  return data;
}

void setup() {
  Serial.begin(9600);
  pinMode(doutPin, INPUT);
  pinMode(sckPin, OUTPUT);
}

void loop() {
  byte dout = digitalRead(doutPin);
  if (dout == 0) { //dout low, new conversion ready
    conversionData = getConversionData();
    Serial.println(conversionData);
  }
}

from hx711_adc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.