I have just tried alternating the LED position number values in the txt file attached and using working code. The Arduino just seems to pick one LED and go with it. I tried adding an if != statement into Arduino but that just made random LEDs turn on. I don't understand what's going on!
hey @alexandros - sorry I am getting muddled. The one I posted is the working example using just one LED. If I add another value to the list and to the code in Arduino everything stops working. I have attached this below:
I have tried the method as you suggested, but that is also not working. It turns the LED on but it gets stuck on and the PWM value doesn't seem to really change. I have attached that here:
Also here is the text file: text.txt
The only way I can get a smooth and reliable increase and decrease in PWM is from the patch+sketch in my previous post. But that only works with 1 LED. I have one more idea and that is to alternate the serial messages between the LEDs
i.e. instead of having 1 255 6
I am going to try that now, but it does make my text file a little more complex to produce, but with it if it works. Thanks for all your help and guidance.
@alexandros I have it working, but only for sending 2 values/bytes at a time, but for more than that it has a problem. I have attached my working code for any suggestions.
I'm controlling 2/16 LEDs at any one time so I need to send 4 bytes (LED no. and PWM). I can get away with sending three, as the LEDs fade: pwmVal2=255-pwmVal1.
Any other suggestions/work arounds are very much appreciated.
Thanks for all your help David. I'm trying sending messages with spaces and ending '\n' now.
Hello @alexandros have attached PD file and arduino sketch.
This was based on example Arduino code that reads an ASCII string with comma separated values.
The problem is that I can't find a way of sending to Arduino without commas etc. I have tried a number of parse example sketches (one that I successfully used years ago). I have attached this sketch here: pd_read_string_another_version.ino
Also, I am using an external library in Arduino (TLC5940) so not sure about using SMS?!
Thank you for your response! I have tried to implement it for my patch. I have attached a file of this part of the patch.
In the PD window, the string appears correct.
When connected to comport, I get the message
"comport: no method for '#5:255/'" (or other string) being sent.
If I send it without using the list (just as pack), the error message does not appear.
Ah yes the comma in no problem, I can change to ":".
I'm trying to control different LEDs and PWM with a TLC5940 driver from PD. I'm trying to send strings of values from PD to Arduino via Serial port.
I'm using the comport object and attempting to pack values as shown below:
s f s f s
However, it's not parsing on the Arduino side. I think it is because PD adds spaces in. I have tried to compensate for this with the start/end + delimiters on the Arduino side to no avail. Can anyone help me with regards to this? Or had similar problems and found a solution?