Hi everyone!
I like writing code in Scheme for a wide variety of reasons. I was wondering about using it control the GPIO pins on my RaspberryPi model B, but I couldn't find any way to do it. Therefore, I decided to write a set of bindings for the WiringPi library using Cyclone Scheme's FFI.
Right now, I've written bindings for all the functions documented here, except for those dealing with interrupts and threading. I don't think it will be hard to write the wrappers necessary for those functions, and I should add them sometime in the next few days.
I've currently got the functions separated out into different library modules that contain related functions. Currently, this is one for the three setup functions, one for all the PWM functions, one for all the non-PWM pin-related functions, and one for the timing functions.
Here's the code, if anyone is interested. You can see an example of usage in test.scm at the root of the repo. Right now, compilation is a bit funky because Cyclone Scheme does not currently provide a clean way to link additional C libraries. Therefore, you need to run a series of commands, as you can see in the Makefile in the root of the git repo. Basically, you need to run the commands suggested by cyclone -d, adding in a link to the wiringPi library for the final stage of compilation.
Unfortunately, code using this library does not currently work using the cyclone interpreter and must be compiled. I believe this is also due to the difficulty with linking in an extra C library. To really fix both these issues, I'd probably have to patch Cyclone, which I'm not particularly interested in doing at the moment.
I hope this comes in handy if anyone wants to use it!
Return to “Other programming languages”
Jump to
- Community
- General discussion
- Announcements
- Other languages
- Deutsch
- Español
- Français
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Türkçe
- User groups and events
- The MagPi
- Using the Raspberry Pi
- Beginners
- Troubleshooting
- Advanced users
- Assistive technology and accessibility
- Education
- Picademy
- Teaching and learning resources
- Staffroom, classroom and projects
- Astro Pi
- Mathematica
- High Altitude Balloon
- Weather station
- Code Club
- Programming
- C/C++
- Java
- Python
- Scratch
- Other programming languages
- Windows 10 for IoT
- Wolfram Language
- Bare metal, Assembly language
- Graphics programming
- OpenGLES
- OpenVG
- OpenMAX
- General programming discussion
- Projects
- Networking and servers
- Automation, sensing and robotics
- Graphics, sound and multimedia
- Other projects
- Gaming
- Media centres
- AIY Projects
- Hardware and peripherals
- Camera board
- Compute Module
- Official Foundation Display
- HATs and other add-ons
- Device Tree
- Interfacing (DSI, CSI, I2C, etc.)
- Raspberry Pi 400
- Operating system distributions
- Raspberry Pi OS
- Raspberry Pi Desktop for PC and Mac
- Other
- Android
- Debian
- FreeBSD
- Gentoo
- Linux Kernel
- NetBSD
- openSUSE
- Plan 9
- Puppy
- Arch
- Pidora / Fedora
- RISCOS
- Ubuntu
- Ye Olde Pi Shoppe
- For sale
- Wanted
- Off topic
- Off topic discussion