Send two vectors from Processing to Arduino

edited May 2017 in Arduino

Hi, i have a big problem.. I'm trying to send two int vectors from Processing to Arduino but when i run processing and also arduino, it says that the Serial Port is busy. I first tried for one vector but it doesn't work...

Tagged:

Answers

  • Please edit your post, select your code and hit ctrl+o to format your code. Make sure there is an empty line above and below your code.

    Kf

  • I eliminate the code.. it was too complex.. can someone tell me how can i solve this problem?

  • please don't post duplicates.

  • This one is worst than the other can you eliminate this?

  • text from the (deleted) duplicate

    Processing will create two vectors A , with 9 integer elements, and B, with 10 integer elements.Each vector will be sent to Arduino that will implement a mean between the two vectors. The results must be sent back to Processing and will appear on the console.

    by vectors i guess he means in the arraylist sense, not the pvector sense.

  • Yes two arrays of int.. i tried many codes but it continues to says Serial Port Busy

  • Run a simple example fist. Make sure you get a connection before you implement sending more complex data. Are you running your arduino monitor at the same time?

    You can check previous posts with working ino and pde code: https://forum.processing.org/two/search?Search=arduino

    Kf

  • I tried to send an 'A' from Processing to Arduino and then back to Processing and it worked. I press play on processing and then i press the arduino monitor and it says serial port BUSY.

  • Don't use Processing and the serial monitor at the same time.

    Just stick to processing. Sending and receiving data as you described is good information. So your system is working and you should proceed to implementing the vector part. Now, you won't be able to send the actual vector, you will need to send their components as a data stream. For example, if you want to send 4 vectors, each having 2 values x and y, then you will write "x1,y1,x2,y2" and on your receiver end you will read the data and convert the data into an array by using the split function, for example. This is a very common practice (and a common question) and you can find this code in the forum. If you get stuck, ask below. You can share your code to get more precise feedback.

    Relevant posts:

    https://forum.processing.org/two/discussion/comment/95206/#Comment_95206
    https://forum.processing.org/two/discussion/16618/processing-with-arduino-void-serialevent#Item_1

    Kf

  • edited June 2017

    (error, sorry)

Sign In or Register to comment.