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
Diff: scale.cpp
- Revision:
- 0:ad334aa4c7c4
diff -r 000000000000 -r ad334aa4c7c4 scale.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scale.cpp Wed Mar 07 17:52:23 2018 +0000 @@ -0,0 +1,38 @@ + +#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; +} \ No newline at end of file