Go Down

Topic: VSync Library - Synchronize variables between Arduino and Processing (Read 739 times) previous topic - next topic

erniejunior

Hi all,

I just finished the first version of my VSync library which 'magically' binds two variables on an Arduino and in a Processing sketch and keeps them in sync. Synchronizing between two arduinos is supported too.

Have a look here: http://erniejunior.github.io/VSync/ and play with the examples.

I would love to hear your feedback.
Maybe somebody has a use for it.




JSan1964

#1
Jul 06, 2014, 09:47 am Last Edit: Jul 06, 2014, 10:09 am by JSan1964 Reason: 1
HI, I'm loving your library. It is much better than parsing the data  but I think I am running into a problem. I am using your bidirectional example.  What I am doing is synchronizing 32 variables (arduino and processing) and reading a rotary encoder to run a dial on the processing screen driven off of one of the synchronized variables. What I want to do is be able to hit a button to reset the encoder to position 0 but when I try to reset, it goes to zero initially but then I think it reads the buffer that was stored for the variable that runs the dial and jumps to that value. I try to "rezero" the variable but the encoder steps one (pulse++ or pulse --) and adds or subtracts from the last value.

Code: [Select]
newpulses=0;
pResetEncoder=0;
aResetEncoder=pResetEncoder;
pPulses=0;
pulses=pPulses;
 println("pResetEncoder"+pResetEncoder);
  println("aResetEncoder"+aResetEncoder);
 println("pulses"+pulses);
 println("pPulses"+pPulses);


pulses26  <------------------------------------------
pResetEncoder0
aResetEncoder0
pulses0<-------------------------------------------
pPulses0
26
pulses62<---------------------------------------------
pResetEncoder0
aResetEncoder0
pulses0
pPulses0
26

If I stop then restart processing, it resets to zero and steps correctly.
Is this data stored on the arduino side (which has the sender.sync and receiver sync  or processing side which has the ValueReceiver and ValueSender ? Is there a way to manually change one (pair of) value(s) or "reset" the whole thing to gather the new values after the first initialization?
Another option would be not to use this variable within the scope of your library  and send data via serial but not sure if and how to do that. I'm new to arduino so please excuse my newbie-ness. Thanks for the library. Joe

Go Up