Wednesday, November 18, 2009

USB debugging Make Controller Kit

One of the problems of the Make Controller system is that there is not too much example code out there on the Net. I was having a very hard time understanding how the Debug system worked. It turns out that the Debug system is done through OSC, so I just gave up and started using the much simpler USB system.

When compiling your program (aka Firmware) in MCBuilder, don't forget to go into "Info" and under the "Config" tab make sure you check "Include USB System".

At least on OS X, once you've built and uploaded your compiled program to the Make Controller board, you need to unplug the USB cable between your computer and the board, and plug it back in. Then bring up the "USB Console". If there is nothing in the "port" selector, unplug the USB cable and plug it back in one more time. This time, you should see some kind of "/dev/..." device in your port list, and that means that the USB system is working. If not, unplug and replug the USB cable again.

Here is a sample code snippet that should output some data to the USB Console:

char buffer[40];
int blen;

Usb_SetActive(1);
blen=sprintf(buffer,"delta=%d\n",my_time-last_time);
Usb_Write(buffer,blen);