System to manage inventory for a cooler. Allows real time check in of products via RFID, as well as check out. Also includes a scale to weigh products upon check out, and has a real time temperature tracking system that sounds an alert if the cooler gets too hot.

Dependencies:   DHT11 HX711 MFRC522 SDFileSystemEditied mbed

scale.cpp

Committer:
vincentrc
Date:
2018-03-07
Revision:
0:ad334aa4c7c4

File content as of revision 0:ad334aa4c7c4:


#include "functions.h"
#include "HX711.h"
#include <stdio.h>

float scale(HX711 scale)
{
    float weight;
    int x;
    
        fflush(stdin);
        getchar();
        printf("\n\r\n\rPlease remove all weight from scale, "
        "then press any button to zero the scale\n\r\n\r");
        getchar();
         scale.tare();
        
        printf("\n\r\n\rPress any button again to begin weighing!\n\r\n\r");
        getchar();
        

         weight = scale.getGram();

        
        //Handles negligible weight and calibration factor
        if((weight < 0.5) && (weight > -0.5))
            weight =0;
        else
           weight *= (15.625);
            
        //Converts to pounds
        weight *= 0.0022046;
            
        printf("\n\r\n\rWeight:  %.2f lbs\n\r\n\r", weight);
            
            
        return weight;  
}