Dear groundfungus, thanks for your contribution.
groundfungus:
That code reads one byte, only, not the entire message. How is the message from the scale formatted? Is there a terminating character (like a carriage return and/or line feed)?
Without Arduino UNO, I am able to show the data flow on Putty session screen. I am then able to log them through Putty "log all session output" option to obtain a CSV file as below (G is for "gram" and the "OK" is because the scale display shows on "OK" once it reaches equilibrium):
animated gif hosting
In order to show the data flow on Putty session screen, I just followed the scale user manual, setting up the parameters such as continuous reading, time step, etc. etc.
Something like (please refer to user manual attached for better understanding, but not fundamental, it is just to get an idea):
031517 ENTER 100 STORE (date)
150320 ENTER 101 STORE (time)
0 ENTER 79 STORE (date/time printed out)
30 ENTER 89 STORE (time step, here 30sec)
Just for reference the serial parameter of Putty - scale communication are:
Baud rate: 9600
Data bit: 7
Parity bit: NONE
Stop bit: 1
Of course, I would like to read the whole message (the whole data flow). How could I do that?
I did not put any terminating character, the scale was sending the data with date, time, reading with that format ALREADY.
groundfungus:
If you want to read from the scale and use the serial monitor to troubleshoot the sketch you can't use pins 0 and 1 (the hardware serial port) for the scale. Only 1 device can use a serial port. You could use one of the software serial libraries for the scale if you have an Uno or a different hardware serial if using a Mega or one of the other boards with multiple hardware serial ports.
To avoid confusion: at the moment I cannot connect the scale to Arduino UNO, I just connected the Arduino through the TLL converter to my PC to try to understand if I could build any sort of TX/RX that I will use once I plug in the scale. I thought that typing something on Putty will act as a flow of data that Arduino would log into the CSV file...perhaps I am wrong with this approach.
What I will expect once I connect the Arduino to the scale is to have the data flow logged on the CSV file on the SD card.
To give as much information as possible please also find attached my scale user manual.
Thanks.
W SERIES RS232 user manual.pdf (251 KB)