I'm hoping someone can help.I am new to any form of coding, trying to learn from the examples but I am finding the interface very confusing on visual studio.I can get the example projects working to demonstrate all the capabilities of the spatial phidget.

However I can't work out how to alter the multi-servo program to facilitate multiple spatials.

I think my project should be simple, but I don't have enough know how to do it.

I have two spatials connected via a VINT HUB with USBall I need is to be able to log the accelerometer data and gyroscope data from each spatial and output it to an excel or csv file with a timestamp.

each spatial needs to record simultaneously as I plan to record the movement of a persons hand using these.

Is anyone able to share any code or point out the relevant examples I should be looking at?

the spatial examples don't seem to translate to multiple phidgets and the spatial example of datalogging when I try to run the code it gives 76 errors.

I'm continuing to learn my basic coding but I think I'm a long way off being able to figure this out at present.

For each new channel that you open, you need to provide a new handle (like "spatial" in the code you posted). You create both handles, set different hub ports for each one, and then assign a data handler for each one. In this case, you want the SpatialData event, which triggers each time new data comes from the spatial. You can see how this works by looking at the spatial_SpatialData function in the sample code (make sure you are looking at the Spatial example, not the compass calibrator example).

You've been very patient with someone clearly out of their depth. I think what I struggled with understanding is how the visual studio breaks up the program. I have the spatial example but I can't work out where is the specific code that I'm looking for. The example utils is too complex and is generic for all so I assume that just created the dials on the form. Which part of the program or what file specifically do I need to be looking at to find the spatial coding?

You're correct that a lot of the code in the C# examples serves to manipulate the graphical interface and be a general example for any Phidget Spatial device. This is the downside of examples with graphical interfaces, I suppose.

In the above code, the spatial object is defined, and four event handlers are added to it: One that triggers when the channel of the desired type (spatial) attaches, one that triggers when it detaches, one that triggers when a Phidget error occurs, and one that triggers whenever data comes in. Then we attempt to open the spatial. You can duplicate this code for another spatial (use a new handle like spatial2) but set spatial.HubPort to different values for each depending on which hub port they're connected to.

The next code we're interested in is in the function spatial_SpatialData, because this is the function that triggers when data comes in.

This is the relevant part of the data handler- it just updates all of the labels on the interface to the most recent value for each type of data coming in. If you were using multiple spatials, you could use "sender" to figure out which one triggered the event: