Recently I got on the idea that the Lua print command in Nspire Lua might print to the serial console. To test this, I built a max232 TTL converter and hooked my nspire to my laptop. And yes, it printed to the serial console!
Then I ordered an Arduino Uno, with the idea to hook it up to my nspire and control stuff.

A few days ago I received it and I started working. I had some problems until today because the the voltage on serial port of the arduino was to high for my nspire, and caused a reset everytime I connected it. Today I discovered (with the help of Kerm and benryves) that its only does that when its getting its power through usb, and not the power connector. So I switched to another power supply and all was fine Smile

The print command in Nspire has some limitations though, you can only send bytes with data 1 to 127, and its also not the only data that gets send to the serial port. To overcome these problems, I made a little simple protocol to talk with my arduino. A sample data packet (in ascii) looks like this:

Code:
nomOKOCEHONOKOFOOOO@BDFON\r\n

"nom" defines the start of a data packets, and "\r\n" the end (it gets automatic added with print). 2 chars represent one byte that has been split in two (to be able to send 0-255).

My first real world example is controlling a little led display through my nspire. The arduino here just acts as a "proxy" to send the data to the display.





Sadly though I can send data (yet) from the arduino to my nspire, but if I do some work on reverse engineering the other dock connector pins, I think I'll be able to find a solution.
This is really nifty. Any idea why you can't output a null character? Seems like one solution would be to print everything in hex (doubling the necessary data output but allowing for any data)
I imagine you can't output a null character with the Print routine because it uses null terminated strings Wink
Qwerty.55 wrote:
I imagine you can't output a null character with the Print routine because it uses null terminated strings Wink

I would imagine that means it still sends a null as the last character, and if that's the case you could just use segmented data.
Well, the Lua print function adds \r\n to the end of every string it sends, so its not really convenient to do it in parts. I actually split my output in two, to be able to send the full range. For example:

Code:

01011110

Becomes
01000101
01001110

I add both halves to "0100" and create 2 new bytes.

Anyway, thanks Smile
I'm now looking for a way to send data to my nspire, which is even more fun.
why not use \r\n as a signal to your hardware to wait for the second string?
Its does that Smile
Its working perfect, I just needed the little 'protocol' to send full data.
elfprince13 wrote:
Qwerty.55 wrote:
I imagine you can't output a null character with the Print routine because it uses null terminated strings Wink

I would imagine that means it still sends a null as the last character, and if that's the case you could just use segmented data.
Indeed, that's what I ended up having to do with the non-direct gCn bridges, so that I could send out-of-band data. Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement