Ah, I see. So does the array need to be there, or should it be removed?
Two more questions if I may. Firstly should I be trying to narrow down packets using the following:?
while (nbytes>16 && nbytes <=32) {
And secondly, I am getting these errors about the unqualified-id. I’ve looked at line 5 6 and 7 of the code, however this is just the UDP Udp; part. It looks like all of the ;'s are in place on each line, so I’m not sure what it’s referring to? I’ve tried changing the standalone if’s to else if’s, which doesn’t seem to fix the issue (in fact, it makes matters worse).
/udp_parser.cpp:5:1: error: expected unqualified-id before 'else'
/udp_parser.cpp:6:1: error: expected unqualified-id before 'else'
/udp_parser.cpp:7:1: error: expected unqualified-id before 'else'
Thanks for your help as well, I’ve learned a lot so far!
Hi guys !
I just ordered my sparkcore and I will see if I can modify my teensy/arduino artnet library for the sparkcore.
Do you guys know if there’s a way programatically to know if we’re on the sparkcore or another board ?
here’s the link to the library:
Hi @nlecaude – I actually came across your library on GitHub while trying to get my original code to work, but trying to port it to Spark was just way beyond me.
If you manage to port it over, I’ll be your #1 fan!
Thanks @bko, it’s looking much more promising now. That code outputs values now. The weird thing is that it seems to always provide the same values, even when those bytes are changing (verified by packet sniffer).
x is always 536874920
y is always 536876605
z is always 536874688
The hex for these strings is 20000fa8, 2000163d, and 20000ec0 respectively, but I can’t find these in the packet, even if I take away the 2000 at the front.
Here is the packet sample sample (you can see in the fourth row the three ff bytes which are the values we want as x, y and z respectively, and should output as 255 after conversion from hex to integer:
My thinking is that it must be pulling more information than it should be and adding it together, but I don’t understand how…
Those look like memory addresses in the core memory. How are you printing them? Just Serial.println() as you show above or something else. There might be a pointer versus value confusion somewhere since x, y, and z should be 8-bits each. You probably want to print them in hex or something since a value 0x00 is not an easy ASCII character to see.
Yeah, just the Serial.println() a per the code. Would make sense if it’s a memory address, as only the last four characters printed change (although the output is the same even after reboots…)
Will have to look into printing them in hex tomorrow, and see how it goes from there.
I’ve been trying to figure it out, but just can’t figure out why the hex won’t convert to a decimal… I need to use a decimal to set a value on an analogue output, right?
Been following along hoping to maybe get a couple of sparks for this same purpose, I found https://gist.github.com/deftx/9377546 has anyone taken a look at that?
I was able to make my library work however it seems that the UDP object in Sparkcore cannot read packets bigger than 512 bytes which is problematic because an Artnet frame is usually 530 bytes…
I’m hoping there will be an easier way to change this from the build IDE, but if you’re compiling locally ( https://github.com/spark/core-firmware ) then you could change the UDP buffer to be any size you like!
It sounds like you’re already familiar with this, but in case you haven’t setup the local build, it’s fun to be able to change anything you want. Mohit made a great tutorial here: https://community.spark.io/t/the-spark-core-firmware/532