Jump to content
Markel

Energia program does not load to MSP430FR5969 LP

Recommended Posts

Hi,

   I am using Energia 1.8.7E21. I am interfacing a HX711 Weighing Scale kit to MSP430FR5969 Launchpad. I am using a Energia Code that worked at another weighing scale project more than a year ago. When I program it, it runs 1 time and I see the output at Serial Console. But when I program again there is no output. Out of 10 programming the first one only has output. The rest do not have output at Tera Term. To confirm that the program does not run I put a code to turn on the red led. But the red led did not turn on.

#include "HX711.h"

#define DOUT  5
#define CLK  6
// most launchpads have a red LED
#define LED RED_LED

HX711 scale(DOUT, CLK);

float calibration_factor = -7050; //-7050 -130000
void setup() {
  // initialize the digital pin as an output.
  pinMode(LED, OUTPUT);    
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  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.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(), 3);
  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();

  //digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)

  if(Serial.available())
  {
    char temp = Serial.read();
    
    if(temp == '+' || temp == 'a')
      calibration_factor += 10;
    else if(temp == '-' || temp == 'z')
      calibration_factor -= 10;
    else if(temp == 's')
      calibration_factor += 100;
    else if(temp == 'x')
      calibration_factor -= 100;
    else if(temp == 'd')
      calibration_factor += 1000;
    else if(temp == 'c')
      calibration_factor -= 1000;
    else if(temp == 'f')
      calibration_factor += 10000;
    else if(temp == 'v')
      calibration_factor -= 10000;
    else if(temp == 't')
      scale.tare(); //Reset the scale to zero
  }  
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×