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.
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
OK. Note to self: I was close. This is the correct way to open a serial port:
After installing those libraries, the executable should now run!
A similar procedure can be performed for Intel machines as well by replacing the "armhf" with "i386".
Thank you for posting this Bo, I had this issue several times and it was diffcult for me to find.
How could I find the corresponding date for: "The monday of 2 weeks ago" "The next sunday" "The last day of the current/next/prev month ?"
The monday of 2 weeks ago ... either now/weekday = 1 [now - 14][now - (6 + now/weekday)] The next sunday ... either now/weekday = 7 [now + 7][now + (7 - now/weekday)] The last day of the current/next/prev month ... http://www.rebol.org/view-script.r?script=date-time.r
Giuseppe, individual date calcs are relatively easy. Designing a dialect to interpret human expressions of them is more work, though still doable. I have a number of things that do part of it, but no complete, open system I can post.
Watch for boundary issues. Here are a couple helpers that show what I mean.
set 'last-day-of-month func [date /local d] [ d: date d/day: 1 d/month: d/month + 1 d: d - 1 d ]
set 'same-day-next-month func [date /local d] [ d: date d/month: d/month + 1 if d/day < date/day [d: d - d/day] d ]