Hi all,
I've been having trouble getting some code that I combined from different sources to work properly, and after a few days of tweaking the code, I haven't been successful in getting it to work as it should. Any help would be much appreciated as I'm completely new to Arduino programming.
Goal
I want to collect weight readings from a digital scale and store them in a Google Doc/Spreadsheet via WiFi.
I wired a digital scale load cell to my Arduino Uno and have been getting good readings, as discussed on this site: Arduino Load Cell Circuit & Sketch for Calibration Test | Airtripper's 3D Printer and Arduino Blog (the load cell code I'm using is here: load-cell-test/load_cell_test.ino at master · Airtripper/load-cell-test · GitHub). I found a tutorial on storing Arduino input data in a Google Doc/Spreadsheet and the first step is to connect the Arduino to a wireless network and establish a web server where input data can be displayed (tutorial: http://www.daviom.com/tutorial/arduino-server-google-drive-storage/). That tutorial uses data from a temperature sensor as the input data. I am trying to replace the temperature calculation code with the Airtripper weight calculation code (pasted above), but I have made some kind of mistake in doing so (my combined code is attached).
Problem with Combined Code
The code includes the following line to display specific information when you navigate to the WiFi shield's IP address:
// Output the JSON object
client.println("{\"projectid\":\""+projectID+"\",\"value\":"+weightAsString+",\"sheet\":\"weight\"}");
When I run the code with nothing on the scale, weightAsString displays as -500, but it should be 0, of course. When I run the code with something on the scale like my iPhone (113 grams), weightAsString displays as like -470.
I'm sure the problem arises because I included the Airtripper code in a way that undermines its functionality in calculating the weight, but I don't how to correct this.
Any ideas or help on how to remedy this issue would be much appreciated, and please let me know if I can clarify anything or provide more information that could be useful in addressing this.
Thanks so much!
My Combined Code
Due to the maximum allowed post length, I can't include the code, but the .ino file is attached.
Load Cell Code
WiFI Code
http://www.daviom.com/tutorial/arduino-server-google-drive-storage/.
Arduino_to_Google_Spreadsheet_7_14.ino (6.71 KB)