I was wondering if someone of you had already try to use the OSC to communicate with Arduino.
I found some informations in the FLOSS manual that suggest to make them transmitting using Processing or PD. Is it necessary to pass from another software?
I am using it to connect some DIY controllers such as a piezoelectric and a gyroscope sensors.
You shouldn’t have to use OSC at all. Look at the bottom section of the floss manual here. It describes how you can interface directly with the Arduino using the serial opcodes. If I was you I would do it this way and bypass all other software.
I know people have run Cabbage on a RPI. With a touch screen it would make a nice sound toy. But I probably do prefer the tactile nature of switches and faders.
You could always pick up an Arduino shield for the RPI and have the best of both worlds
I am still trying to communicate from Cabbage to Arduino.
As you suggested I used the serial opcodes, but it seems to have some trouble finding the communication port, sometimes it reports this error on the Csound output: INIT ERROR in instr1:/COM7 not available.
So, I ran the same .csd on CsoudnQt using the same port COM7 and it worked.
When I play it, Arduino start blinking, but on Cabbage it doesn’t.
Does anyone had already tried to communicate using the serial opcodes on Cabbage?
No way, you killed it with an Arduino? Wow I asked Sigurd, but he can’t think of anything that might causing the problem. I’ll take a look once I am back.
Yes, with an Arduino and a 9V battery…Do not worry, in the meantime I will try on other OS and computer!
Ah, I took a shot on the new cabbage release but I get this message:
error: syntax error, unexpected T_IDENT (token "serialBegin")
from file C:\Csound\Csoundino_04.csd (1)
line 23:
>>>iPort serialBegin <<<
Unexpected untyped word iPort when expecting a variable
It seems that it is not recognizing the serialBegin opcode
That’s strange as the latest Cabbage use the latest version of Csound. Can you try the CsoundQT that comes with the latest version of Csound and see if that works?
I tried it on the CsoundQt Version 0.9.5 that comes with Csound 6.10 and it works, but I noticed that if I stop and run again the csd It gives the same error that I found in Cabbage:
INIT ERROR in instr1:/COM7 not available
After that I need to close CsoundQt and open it again if I want to get it work.
Maybe the port is being opened ok but is not closing properly, thus preventing it from being opened again. That would explain the Cabbage error. Can you confirm that the same thing happens if you run the .csd from the command line?
I ran ten times the same csd from the command line and it worked properly, printing values from a potentiometer and controlling the amplitude of a sound.
On csoundQt it works for the first time, after that it says that the port is not available or it crashes.
Thanks for checking. It would appear that recompiling an instrument that uses these opcodes is causing the problem. I will prepare a simplified example in C for the Csound devs, but it won’t be till later next week at the earliest. I’m afraid until then you’ll have to down tools and work on something else.
I’m trying to create another protocol to communicate between Arduino and Csound. The difference with the already existing serial opcodes is that I would like to store a 10 bit arduino’s value in two bytes.
I wrote the arduino sketch to convert an int value in two bytes, but now I was wondering how can I reconvert the function in Csound. Can I make it as a UDO? Could be an idea or it would be to complicated?
You want to combine two incoming bytes of data, combine and represent them as a single value? I guess you could considering you have bit-wise operators in Csound? But I’m no expert on this serial stuff.