Does anyone have a solution for sending individual bytes to the iCreate?
Our team wants to run scripts instead of constantly polling the create for distance/angle values because it is insanely inaccurate and inconsistent.
I know how the iCreate open interface works, we actually ran the iCreate on its own (w/out CBC) last year for the game as a blocking device.
The libraries on the github repository (http://github.com/kipr/cbc/tree/master/userlib/libcbc/src/)seem to offer serial writing but our team tried to use
serial_write_byte(153);
and similar commands, the code wouldn't compile/download to the CBC.
Any help is greatly appreciated!!
I suspect the KISS-Sim libs don't include this function, which causes KISS-C to refuse to download it. Can you try loading the program via a flash drive and report back on whether it compiles? (If the flash drive works, then you might try using the Norman/Nease Mods for downloads, as they don't rely on the KISS-Sim libs.)
Another possibility is that you're using the wrong function. I recall seeing several variants in the CBC source code, including create_write_byte, serial_write_byte, and the misspelled serial_wryte_byte. If you find that this is the problem, please let us know... I'm curious which of those functions work.
Good luck!
-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS
I have never really used it, but CBCJVM (since version 10.3) has create scripting support. Braden might be able to supply you with some sample code. I am not sure if this is what you are looking for or not, but it might be of help anyways.
Good call on the wrong function, I checked that library again and it is create_write_byte.
But it still doesn't compile/download from KISS-C, I'll try the flash drive thing at our next meeting.
Thanks for the suggestions
Adam Farabaugh
Hampton High School
I've posted it before, but this might help with installing via a flashdrive: http://github.com/catron/CBCJVM/blob/master/cbc/CBCJVM/tests/CodeInstall... although you'll want to change the directories. Just put it on a flashdrive and run, and it will replace the cbc's code folder with a code folder on the flashdrive.
serial_read_byte and serial_write_byte are defined in that header file, but are not included in any C file for some reason. serial_read_byte in particular is broken by its very definition. Because it returns a char, you have no way to indicate when a byte could not be read (return 0 would be indistinguishable from reading a NUL character, for instance). Here's a quick, better implementation of create byte functions. I haven't tested for syntax but I think it should work:
You'll want to call serial_init() before using these. I'd still point however, that if you're comfortable with arrays and pointers the serial_read() and serial_write() functions are more efficient and will probably produce more concise code.
Another approach could be to simply use ordinary C commands to manipulate the serial port's device file, /dev/uart1. For an example of this check the implementation of the above serial functions in cbcserial.c
--
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction.
Albert Einstein
Project Quadcopter: http://quadcopter.wordpress.com/