Difficult question to answer, because it's impossible to verify any proposed solution. I can merely guess what the problem is:
I don't think that BaudRate should be specified in the Arduino code. I'd write:
DeviceOpen["Arduino", {"COM3", "BaudRate" -> 38400}]
Your
setupScale()
-function is in fact never executed. It's prepended to the Arduino sketch but never executed. You need to call it too! The standard way of doing this would be to addbyte initScale = 0;
in the initialization code, and then in theScale
-function add:if (!initScale) { initScale = 1; setupScale(); }
That way, the setup function will be run the first time you call the function.
Try these things and see if it works.