IRC channel logs


back to list of logs

<delmarre>hey people
<delmarre>i have a dumb question
<delmarre>does guile have any packages which allow you to send commands over a serial connection?
<ft><ad> </ad>
<ft>...unless I misunderstood your requirements.
<delmarre>hmmm, not sure this will do it
<delmarre>need to actually send stuff over a serial port
<delmarre>something like this
<ft>delmarre: yeah, that package let's you do that. You open a port to the device file in question, manipulate the serial specific stuff using guile-termios and then just write to the port again.
<ft>delmarre: I wrote that thing because I wanted to use Guile to remote control a larger signal-processing system that had a small microcontroller that did system management. And that microcontroller had a serial link via usb into the host computer.
<delmarre>reading through the example
<delmarre>and looks like I need to look into termios and stuff
<delmarre>and actually have a clue what's happening haha
<ft>delmarre: Termios is the system interface that controls the serial stuff. On POSIX systems anyway.
<ft>I had this working in cygwin too, if windows is required. :)
<delmarre>i should probably learn more about serial stuff in general haha
<delmarre>trying to get a pen plotter on the go
<ft>Those serial links are usually 8N1 with some baudrate, like 115200bd.
<ft>"8" is eight bits per frame, "N" is no parity, and "1" is one stop bit.
<ft>bd is the symbol rate. In serial links like this, a symbol as two constellation points and thus carries one bit. So the baudrate is also the bitrate in this kind of scenario.
<ft>And that's most of what you need to know about simple uart and rs232 serial links.
<delmarre>yeah so mine is rs232
<ft>uart and rs232 are basically the same; just the signal levels are different, and IIRC the logic in rs232 is inversed.
<ft>But that's the physical layer. You shouldn't have to worry about that.
<delmarre>so reading through your example you get it set into 8n1 mode or whatever
<delmarre>and then after this you could just call displays with the port as the output port to print strings through it
<delmarre>or am I way off the mark?
<ft>You can just write to the port as if it was a file.
<ft>display works, or whatever.
<delmarre>okay sweet
<ft>Then you'll need to implement the plotter's protocol, of course.
<ft>stdout is often a serial link too, btw. When it's connected to a terminal emulator. Those have baudrates as well, because they emulate old serial hardware.
<ft>So yeah, there's not a lot special about this.
<delmarre>when your an art kid who knows v little about computers, there is haha
<ft>Well, you're using something that's not too much of a mainstream language, so it can't be that bad. :)
<ft>But more to the point, you just use termios to set up how the serial link should work, and if you're doing that correctly, the rest if pretty straight forward.
<ft>"Doing it correctly" can be a struggle. I'll admit that. :)
<ft>Especially if you don't know what setup the target uses. In that case: Oscilloscopes. :)
<delmarre>well I asked because I thought it might be easier to do than what I was going to do
<delmarre>which was get my scheme to output files for the plotter, and then actually send them using some python thing I have
<delmarre>would be nice to not have to worry about other languages again haha
<delmarre>my plotter is 8n1
<delmarre>so that makes life easier
<ft>Yeah, it's very common.
<ft>Now the the baudrate. :)
<ft>s/the the/to the/
<delmarre>9600 ;)
<ft>Good luck then! :)
<delmarre>so should be able to just use cf-make-raw!
<delmarre>set the speed
<delmarre>and be off
<delmarre>hopefully :p
<delmarre>this is very good
<delmarre>will have to try it in the morning
<ft>delmarre: The first example in the manual is probably what you want.
<ft>Although you may prefer the module that doesn't use exceptions. I guess that's a matter of taste.
<delmarre>yeah this looks perfect
<delmarre>when you close the port at the end of these examples
<delmarre>is that closing it from further modification
<delmarre>i.e. i would still go on to use tty as the output port even after?
<delmarre>or would I do everything up to that, then write a bunch of stuff to the port, and then close the port
<ft>you'd do the output before you close the port.
<ft>You can't write to a closed port.
<delmarre>sure, cheers
<ft>Neither can you read from one.
<delmarre>you'd think that would be obvious to me wouldn't you
<ft>Don't worry about it. ;)
<delmarre>Very lucky you were here when I asked about that
<delmarre>will actually be a boost for my life being able to do that
<ft>I'm sure someone else would know about serial ports as well. Maybe not about my module, though. :)
<ft>Don't think it has too many users.
<delmarre>how many people are still trying to get pen plotters to work
<delmarre>your audience is limited haha
<ft>I'll manage. :)
<daviid>guilers, playing with C snipset to boost some guile-cv critical f32vector procedures hover hude images, I wrote this but to my surprise it returns wrong result for the min position: any C pro can help me?
<sneek>daviid, you have 2 messages.
<sneek>daviid, ArneBab says: do you mean you need to transform all three areas (IMAGE, SEEDS, shared) into coordinates relative to IMAGE?
<sneek>daviid, ArneBab says: or rather: each of the edges relative to the corresponding edge in IMAGE?
<daviid>ArneBab_: I was very tired :), the translation was as easy as minus left and top from the image particle ... solved, but thanks
<daviid>too bad my battery is getting low, I'll have to leave soon
<OrangeShark>daviid: r[0], r[2] = v[0]; are you trying to assign v[0] to both r[0] and r[2]?
<daviid>OrangeShark: no, both to v[0]
<daviid>OrqI mean yes
<daviid>is this allowed?
<OrangeShark>need to write it as r[0] = r[2] = v[0];
<daviid>OrangeShark: thanks!
<OrangeShark>same for the next line
<daviid>of course, thanks
<OrangeShark>with that, you were just accessing r[0] and not doing anything with it, then assigning v[0] to r[2]
<daviid>OrangeShark: perfect, thank again, have to leave because of battery, bbl
<OrangeShark>daviid: no problem
<rekado_>I ported the rfc822 email header parser from Chicken to Guile. Is this something useful to have in Guile or should this be a separate package?
<rekado_>(The implementation in Chicken is itself a port of the implementation in Gauche)
***rubdos_ is now known as rubdos
<OrangeShark>hello everyone
<davexunit>hey OrangeShark
<OrangeShark>Are there any good examples of projects that are extendable using Guile or maybe like common designs for creating software that can be extended by Guile by users?
<ArneBab>OrangeShark: I don’t know which ones are *good* examples. Lilypond shows dangers of strong coupling — but also huge success — I don’t know how GNU Cash does it.
<ArneBab>OrangeShark: there is this:
<OrangeShark>ArneBab: aren't Lilypond and GnuCash more like embedding Guile?
<ArneBab>OrangeShark: they use Guile to extend the program — embedding is a part of that
<OrangeShark>ArneBab: okay, I think I will look into these projects and probably emacs as well even though it not using Guile to see any common or useful designs (or bad designs to avoid??)
<ArneBab>OrangeShark: ah, you might want to look at emacsy:
<OrangeShark>ArneBab: oh thanks, I will look into that too
<ArneBab>it was a proposed kickstarter, I’m not sure whether it got past the draft stage since only ~2k$ were raised (of 5 needed)
<ArneBab>here’s more:
<OrangeShark>ArneBab: thanks, I think I have a lot to look into now.
<ArneBab>here’s the (alpha-quality) code:
<wigust>OrangeShark: Here are some Guile mostly libraries than applications grabbed from
<OrangeShark>wigust: thanks, I am of aware of those. I am more interested in applications
<amz3>héllo all :)
<OrangeShark>hello amz3
<delmarre>question for you guys
<delmarre>am thinking soon about building myself a framework for producing drawings on my pen plotter
<delmarre>and think i'm gonna be using guile (have been using chicken before)
<delmarre>what is the actual difference between vectors and arrays?
<delmarre>in guile
<delmarre>and considering most of my framework is gonna be about points on a plane and lists of points on a plane
<delmarre>can I just use vectors for lists of vectors
<delmarre>or would there be some advantage to making arrays of vectors?
<OrangeShark>delmarre: arrays are multidimensional
<delmarre>mhmm. reading through the reference and it says
<delmarre>(make-array 'ho 2 3) gives⇒ #2((ho ho ho) (ho ho ho))
<delmarre>for example
<OrangeShark>a 2 dimensional array
<delmarre>seems to me like you could make a (vector (vector ho ho ho) (vector ho ho ho))
<delmarre>and have the same thing really
<delmarre>and implement some way of building these with a given shape
<OrangeShark>delmarre: I think array uses a single vector underneath
<OrangeShark>delmarre: "In the current implementation, an array uses a vector of some kind for the actual storage of its elements"
<OrangeShark>delmarre: in the example, it would be like (vector 'ho 'ho 'ho 'ho 'ho 'ho)
<OrangeShark>that is how array stores it
<delmarre>and you also can't have an array of vectors
<delmarre>oh wait
<delmarre>maybe you can
<OrangeShark>yeah, but why would you need an array of vectors?
<davexunit>OrangeShark: you're familiar with Haunt. that's extensible with guile. but I guess it's not exactly what you're looking for.
<delmarre>idk yet haha
<davexunit>Guile itself is extensible with Guile using the .guile file
<OrangeShark>davexunit: yes, I am just curious of other ways
<delmarre>no i guess i won't need arrays of them
<OrangeShark>delmarre: what values will you be storing in them?
<delmarre>i suppose i will just be working with positions, sets of points on a line...
<delmarre>and some velocity, acceleration vectors
<daviid>delmarre: I would look into other similar projects and see what data structures they selected, try to avoid a bad start design ...
<delmarre>yeah for sure
<delmarre>i know there's a guy doing something similar in lisp
<delmarre>will have to look over his stuff
<daviid>plotting is as old as computer 'science'
<daviid>the racket folks may have some, or chicken ...
<delmarre>for sure. unfortunately the people who did it early were much smarter than me haha