I'll try to make this quick and to the point. Trying to interface a device that has a rs-232>ttl converter attached to it (the device is like a controller). I attach the signal from EZB D0 to the RX on the ttl converter. The red LED lights with a small green flashy led on the converter. So far so good. I'm not sure I understand all the functions on the serial terminal, so i skipped and went to the sendserial command to try and get it to work. The device uses baud 19,200 to communicate. The device uses several commands, each command is preceded by a ">". IE to send a command to trigger and play a track would be:
That would play track 0 or the first track. So I wrote a line :
I get no error in my syntax, and i do see the blue light go on the ezb when i start the script, but nothing happens on my device. I am sure everything is working on the device, as i tested it all before i connected the ezb and its fine. Maybe I just have no idea how to write the proper code, or perhaps I need some other wire to be connected to the ttl converter. Hopefully I can get it working with some suggestions. I feel I am close.
Below is an image of the ttl converter and my pin on the rx.
You most likely need to append a carriage return. Check the datasheet if it needs both an \r and \n
So example would be...
SendSerial(d0, 19200, ">play 0", 13, 10)
Thanks DJ. The documentation is quite sparse. In fact its the reason I'm poking in the dark. Here is the all the info from their manual, but i will try and add the returns to see what happens:
>>The serial port operates at 19.2kbps, 8 data bits,
one stop bit, and no parity.
The port implements
a standard RS232 interface and conversion circuitry may be required to interface to a TTL
serial port (e.g., Basic Stamp or other microcontroller).
And the commands;
If the optional
parameter is supplied, this comm
and sets the current playback mode.
If the mode parameter is not
supplied, this command retrieves the current playback mode
(0lay once, 1:repeat single, 2:
loop all, 3:random play).
play <track number>
This commands starts playback and requires an
argument that indicate
s the number of the
track to play (e.g., the fi
rst track is track zero).
ooops, I mean..
SendSerial(d0, 19200, ">play 0", 13, 10)
or in hex it would be
SendSerial(d0, 19200, ">play 0", 0x0d, 0x0a)
Here is a reference chart for ASCII characters and their respective Decimal or Hex values:
DJ beat me to the code. Send it through a EZ Script just like that and see what happens. When I was struggeling with getting my Kangraroo X2 working I had to place that Return code at the end. I found I didnt need the New Line code but your device may be different.
One other thing Will. If you only have one wire connected between EZB and the RX of your device you may need to run a ground wire between the two also. So run it from theground pin of the same Digital port your sending from (use D0) to the control side ground of your serial device. Maybe that will help.
@Dave is absolutely correct. You must have a shared ground for serial communications.
Interestingly, as I connect the ground from D0 to the ground on the ttl converter, all the LEDs go out on the board (ttl converter board). Still having trouble sending commands. I've shot off an email to support waiting to hear back from them.
Thanks guys, still waiting to hear from them. Here is another question. More for DJ I think. Is there a way to control another program running on the same PC that EZB is running on. In this instance, lets say you want to have EZB control the triggering of events, using say visual basic, or powerpoint etc. ( the software uses Active x). The device software i'm using allows control of the software (not hardware) using a console software solution. This is not an ideal solution as it must be tethered to the computer. But also asking out of curiosity.
Another option is the hardware has a built in IR controller. So you can send commands with a stardard handheld tv remote control. Sooooo, possible to connect an Ir transmitter of some kind to the EZB? Is there an i2c or other hardware IR device the EZB can control?
Edit 2: Ok i see there is an IR reciever, in i2C folder, can a trasmitter used as well?
There are a few ways to have EZ-Builder control other software, or at least "talk" to it. Telnet, http, UDP broadcasting and even running of software (which could include macros etc.)
I'm sure DJ has way more experience and advice on these methods than I have as I've only really briefly touched on them myself (it's always been on the list of things I need to look at but always been bumped down the list by something else so I'm not 100% clear on EZ-Builder's capabilities).
As for the original question, I think everyone else has covered everything I would have said anyway. The only additional thing I would say is, and I don't think it makes a scrap of difference but it's what I did with the TellyMate when I had a few issues, is to break down the data. I suspect doing so must have fixed a syntax error in the data that I hadn't spotted but it may have more to it.
Basically, split the data up a bit more in the SendSerial() command;
SendSerial(d0, 19200, 0x3E, "play", 0, 0x0D, 0x0A)
The data sent should be exactly the same as DJ's example however, like I said, when I had a few issues with the TellyMate doing this seemed to fix them but I am pretty certain it was just really a case of redoing it fixed an error I overlooked. For the sake of a copy and paste it's worth a shot though.
Great additional info Rich, I will give it a try!