Skip to main content
1 of 3
V.E.
  • 1.7k
  • 18
  • 17

Difficult question to answer, because it's impossible to verify any proposed solution. I can merely guess what the problem is:

  1. I don't think that BaudRate should be specified in the Arduino code. I'd write: DeviceOpen["Arduino", {"COM3", "BaudRate" -> 38400}]

  2. 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 add byte initScale = 0; in the initialization code, and then in the Scale-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.

V.E.
  • 1.7k
  • 18
  • 17