Fork me on GitHub
#babashka
<
2021-07-11
>
bherrmann01:07:43

I'm curious, any using babashka on a rasberrypi ? How are you accessing the gpio pins?

Cora (she/her)02:07:16

just in case no one else responds, it looks like you could install wiringpi to get the gpio cli tool and then shell out to that from babashka

Cora (she/her)02:07:32

there are things like this that might be worth trying but I doubt they'd work https://github.com/helins/linux.gpio.clj

onetom07:07:06

i would just use the /sys/class/gpio/ directory with regular file operations. https://www.ics.com/blog/gpio-programming-using-sysfs-interface

👍 4
borkdude12:07:18

Added a bunch more API functions from timbre and clojure.tools.logging, links are updated in the discussion

🚀 6
cfleming22:07:47

Just to check my understanding - I guess it’s possible to have clj files which are used both from bb scripts and also from JVM clojure processes, correct? As long as they don’t use any of the built-in dependencies from bb (and presumably with a little care), they should work in both?

borkdude22:07:32

> As long as they don’t use any of the built-in dependencies from bb I didn't get this part.

borkdude22:07:16

on the JVM you would have to have those deps in your classpath, but in bb you don't if they are built-in

borkdude22:07:39

code that works in bb generally works in the JVM, but not always vice versa. most specifically, deftype/`definterface` aren't supported (currently) and reify/`proxy` in a very limited fashion

borkdude22:07:27

but bb tries to conform to the JVM Clojure semantics as much as possible

borkdude22:07:41

it's not a new / different dialect of Clojure in that respect

cfleming22:07:45

Right, so as long as the deps that the file uses is either built in (in bb) or pulled in via the classpath (in clj) files can be shared. That was my assumption, just checking.

cfleming22:07:18

And things like the default aliases are only available in bb in the user ns, right? So they will only be available in a script without an ns form.

cfleming22:07:00

e.g. str being aliased to clojure.string

borkdude22:07:31

correct. but this was actually just done for command line expressions. in an editor I recommend people to use explicit aliases

cfleming22:07:41

Sounds like good advice, but I’ll have to support those who choose not to follow it 🙂

cfleming22:07:59

I can add an inspection to gently suggest to them that they might not like to do that.

borkdude22:07:29

clj-kondo will also advice them that, in fact, it will just say: don't know what namespace str is

cfleming22:07:05

Hmm, maybe I should just not add support for them, then Cursive would do the same.

cfleming22:07:06

Ok, that will make at least one thing easier!

borkdude22:07:12

In hindsight perhaps I wouldn't have included those default aliases, but I don't want to break it either and for quick command line stuff it can be convenient.

cfleming22:07:23

Sure, no doubt.

borkdude22:07:54

I'm going to sleep now, I'll answer your other questions tomorrow if you have any.

cfleming22:07:10

Thanks, I think I’m good for now - thanks for all the support!

borkdude22:07:37

And thank you for supporting bb in Cursive, that is really cool

cfleming22:07:00

Yeah, I think it will be useful for many people (including me!)