I am having a problem with the new Arduino plugin. I do a few things differently with my python code. So it could be my fault but I thought I would mention here just in case it is a real problem.
The symptom is that the value of the last variable in my list of string variables is always set to the empty string (“”) even though the Arduino is sending down real values. In my case I have 7 string variables - S1, S2, …, S7. The last variable in my list, S7, is always empty. If I increase the number of string variables to 8, then S7 is returned with the expected results but S8 is empty. The first two variables, S0 and S1 are type “OUTPUT”. The remaining are type “read from STRING variable”. Everything else is “Off, do not use”.
I believe the problem is in the Arduino plugin code: plugin.py in procedure
def parseFromArduino(self, inp, output):
This procedure parses the command that comes from the Arduino - something like:
b’>>rd:S1=xxx&rd:S2=xxx& … &S7=xxx’
The variable p1 will be something like this as it goes through the for loop
b’>>rd:S2=none
rd:S3=xxx
rd:S4=xxx
…
rd:S7=xxx
‘
After the last for loop iteration, p1 is a ‘. The variable pK does not find the the “:” and fails the if test which then overwrites the out[S7] variable with the empty string. So S7 was for a short time “xxx” but it ends up as the empty string.
As a side note, sometimes the variable “pin” is undefined causing an exception. This happens in my code 3 times but is not critical for me. In general, it will just use the last value that it had which, in this test case, was “S7”.
For the time being, I commented out the line in the else clause:
out[pin]={“cmd”:cmd, “values”:values}
so that S7 is not overwritten and it seems to work ok, but I don’t know what the side effects are.
I am not able to explain it very well and I don’t really know python that well so I may be way off base. If you are interested and can direct me, I can do more work and send you a better log file showing actual values in the loop. Feel free to ignore this post if I am off base.
I appreciate the Arduino plugin. I currently have 8 Arduino’s running in my house. Thanks for all of your work on that and the other plugins you have done.
Thanks again,
Bill Dawson
dawson1331@aol.com