It seem write/append/lines %filename.txt reduce [a b c d] is not working correctly. I have not newlines.
I have also tried write/append/lines %filename.txt append {sometext} lf
but as soon as the loop run reiterating the same line, I accumulate tons of LF
GiuseppeC
Too many answer for all my question in this world, please, stop, it's a flooding !!! :)
Bo
Hmmm. I know I've done this before, but I can't find any reference to it. In Rebol3, how does one access the serial port? It doesn't work the same way as in Rebol2, as there is no system/ports/serial object.
Version: 3.0.99.4.20
This version has GUI and Serial built into it. Here are some things I tried:
>> ser: open serial:// ** Access error: invalid port argument: make error! [ code: 346 type: 'Script id: 'bad-make-arg arg1: integer! arg2: none arg3: none near: [to integer! speed] where: [to try if init if -apply- open] ] ** Where: open ** Near: open serial://
>> ser: open serial://ttyUSB0/9600/8/none/1 ** Access error: invalid port argument: make error! [ code: 346 type: 'Script id: 'bad-make-arg arg1: integer! arg2: 9600/8/none/1 arg3: none near: [to integer! speed] where: [to try if init if -apply- open] ] ** Where: open ** Near: open serial://ttyUSB0/9600/8/none/1
>> ser: open serial://ttyUSB0 ** Script error: cannot MAKE/TO file! from: none ** Where: to if init if -apply- open ** Near: to file! path
Bo
OK. Note to self: I was close. This is the correct way to open a serial port:
And here's how to write/read data to/from the serial port:
ser/awake: func [event /local p][ p: event/port switch event/type [ lookup [open p] connect [write p to-binary request] read [ result: to-string p/data close p return true ] wrote [read event/port] ] false ]
write ser "ping^/" s: wait [ser 5] print to-string s/data
Bo
The problem I have now is that I cannot figure out how to read data from the serial port. I always only get back the last command I wrote to the serial port in s/data.
Bo
Hmm, I guess nobody has any ideas here nor on Stack Overflow. :-(
Pekr
Isn't serial port occupied by other app? I very vaguely remember, I once met such situation too. Or it might be related to USB to serial converted, not sure ....
Gregg
I've only ever used R2 for serial port work.
Arnold
Bo, what is wrote [read event/port] ? Is it a typo you only made here?
Arnold
(I saw on SO you also had WROTE not WRITE)
Marco
@Bo . Try also to search for "gs: open" in this group (6-dec-2015 by Josh)
Bo
Arnold: "wrote [read event/port]" is part of the awake handler.
Bo
@Marco: Thanks! That's what I was looking for!
amacleod
does r3 not have a set-net function? "** Script error: set-net has no value"
Gregg
Protocols were never completed for R3.
Bo
A long time ago (Sep 2014 I believe), I wrote a question here but never got an answer. I did eventually figure it out, but I recently had to figure it out again, so I'm posting it here for posterity:
Here's the solution when encountering the following:
$ sudo ./r3 sudo: unable to execute ./r3: No such file or directory
ARM devices running 64-bit operating systems don't generally have the 32-bit libraries installed. This can be fixed with the following commands: