Re: euphoria to arduino
- Posted by lpuster Jan 26, 2012
- 2204 views
I wonder if anyone can help, I am trying to get euphoria to turn pins on and off on an arduino using serial, I am using an include file from " serial communications" in the archive posted by Kondor Attila in 2005, I can send a individual char using the function (sio_putch), but can not send a string using (sio_write), I need this to turn on multiple pins, here is the function.
----------------------- sio_write ----------------------- global function sio_write(integer port, integer lpWBuf, integer len) return c_func(sio_write_,{port, lpWBuf, len}) end function
the help file indicates this..... sio_write (port, "ABCDE", 5)
lpWBuf is an integer, so how do I send a sequence, this may be a stupid question, but I am probably the worlds worst programmer.
This is just an educated guess: Try using allocate to reserve some space for your buffer. Allocate returns the address of the buffer. Then poke the string into the buffer. Finally, call sio_write with your port, the address of the buffer, and the length of the sequence. Then release your buffer. Or, if you don't care about reading a reply, you can simply open a serial port like this: comm = open("COM1", "wb") then write to it with puts(comm, "The Data"). (This all assumes you have set the com port parameters beforehand.)