Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : error, disabling serialEvent() for //./COM3

$
0
0
I do not know what is causing the error but your code is structured in a way to make troubleshooting difficult. Since you are the one to figure this out yourself I think you ought to partition your code into distinct elements that allow you to separate what you know works, and may be complete, from what is added or not working. For example the serialEvent function should take care of receiving the incoming signal and do nothing else. In your case it appears that you have 10 images in an array and you want the serialEvent to make an indexing variable correspond to the latest valid incoming number from the Arduino. Incidentally, the index will vary from 1 to 10 and so it need not be a float. A simple byte would do. I am guessing your serialEvent function should read the latest incoming value, compare it to the current index value, and then change the current index value to that new value if it is different. You would put diagnostic printlns in there to follow the progress and pinpoint exactly where an error occurs.  All that other code for changing and fading the image belongs in its own function that you call in the draw loop. I am wondering where in the program you are getting the error message. Does the code ever reach the println(inByte)? Does the code ever reach the println(Serial.list())? I think there may also be the possibility you are shorting or drawing too much current at the Arduino thereby causing the computer's serial port power manager to shut down the port. That might result in such an odd error message. A test for that would be to run the program on a plain Arduino that does not have any circuits added to it. 

Viewing all articles
Browse latest Browse all 1768

Trending Articles