Libmonome C programming

Can anyone run the monome 256 using libmonome using just a c script. In the past with help, I’ve managed to see on the command line the monome has been connected but I cant get any further. I need to know if someone can do a step by step, how to get button presses, lights blinking ect using libmonome I pressume but with just a c file execution please.

Many Thanks

1 Like

I just tried to build libmonome and ran into a liblo not found issue, in spite of the fact that liblo is installed.

I threw a hail mary over to the homebrew folks:

@wrl any advice for us?

It builds on my computer just fine.

I commented on your GitHub issue, but I’ll repeat here… can you try installing the Xcode command line tools?

Run the following on a command line.

xcode-select --install

This will do the trick
LIBRARY_PATH=/usr/local/lib CPATH=/usr/local/include waf configure

lib/include paths on OSX are weird. try alesaccoia’s suggestion and, if that doesn’t work, pastebin me the build/config.log please.

brew uninstall -f liblo
brew install libmonome

worked for me

So, that worked for installing the library using homebrew, but I’m still having trouble building examples/test.c

First I ran the LIBRARY_PATH command from @alesaccola. Then I ran gcc -o test examples/test.c, which resulted in

Undefined symbols for architecture x86_64:
  "_monome_led_all", referenced from:
      _main in test-6a9c2d.o
  "_monome_led_col", referenced from:
      _test_led_col_8 in test-6a9c2d.o
      _test_led_col_16 in test-6a9c2d.o
  "_monome_led_intensity", referenced from:
      _fade_out in test-6a9c2d.o
      _main in test-6a9c2d.o
  "_monome_led_map", referenced from:
      _test_led_map in test-6a9c2d.o
  "_monome_led_ring_map", referenced from:
      _test_led_ring_set in test-6a9c2d.o
  "_monome_led_row", referenced from:
      _test_led_row_8 in test-6a9c2d.o
      _test_led_row_16 in test-6a9c2d.o
  "_monome_led_set", referenced from:
      _test_led_on_off in test-6a9c2d.o
  "_monome_open", referenced from:
      _main in test-6a9c2d.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Here’s the build/config.log

the full command line for that should be
gcc -o test examples/test.c -I/usr/local/include -L/usr/local/lib -lmonome

Ah, thank you. That built. No lights on the monome yet though.

Hopefully you’re going with this. Been using libmonome a long minute for all my LED and button-press needs.

No, not going. As I said in my previous comment, successful build but no lights.

OP requested somebody write a step-by-step. I’d appreciate that too!

So when I run the command ./ configure inside the libmonome directory I get: The configuration failed.

When I ran
gcc -o test examples/test.c -I/usr/local/include -L/usr/local/lib -lmonome the compiler didnt complain but nothing seemed to happen after…

That gcc command creates an executable file named “test” that you should run.

No luck it runs for a minute no responce when a buttons pressed then the program terminates. I tried Tinyosc from here: but no result.

Almost I recovers a post I made earlier in the year “Monome RPI2” where I had help running monome on the RPI but couldnt get a c programe running with that. I havent any of it that also works on mac… heres the link:

Has anyone successfully run the monome off c alone? If so please share how you managed it, the much needed help will be appreciated. Ive compiled libmonome on the pi top, but not sure where I can go from there. The mac doesn’t yet compile as you can see from this photo. (not sure how to resolve that yet)

1 Like

Looks like you need to install liblo first.

I just noticed that there is a homebrew recipe, might be helpful.

if you also don’t need osc in libmonome, you can do ./waf configure --disable-osc

Talk about a necrobump! I think this is the right topic, though.
I’m able to address the LEDs of my Arc just fine, but the encoder delta callback doesn’t appear to be working. Any thoughts would be appreciated here.
consolidating relevant lines of code, here’s what I have:

// in headers
#define DEFAULT_MONOME_DEVICE "/dev/tty.usbserial-m1100276"

// in main - 
arc = monome_open(DEFAULT_MONOME_DEVICE);
void * bb = NULL; // do I need this?
monome_register_handler(arc, MONOME_ENCODER_DELTA, delta, bb);

// later...
void delta(const monome_event_t *e) {

And here’s my whole script, in case a brave soul wants to wade through messy, amateur C code: GitHub - zjb-s/c201: terminal melody tracker

thanks in advance <3 and thanks to @Dewb for all the help on discord

edit: Solution: I was missing monome_event_loop(arc); :wink:


also reviving libmonome c programming. its very fun and its so great that libmonome works seamlessly on so many platforms :slight_smile: I’m currently using it with Bela.

the test code simple.c and test.c work without problems. (i.e. monome_led_set works and monome_led_intensity works). though, I am having trouble getting monome_led_level_map and monome_led_level_set to work. both don’t have any errors, but neither will light up the grid in any way.

I’m using the latest version of libmonome (c63d65e6a166a34308bda08c1525fdf68a72e8c4) and serialosc (e92a07889ac9ca13fb25c6b13c96f8df5b19c968) and compiled in a standard way.

here is my code in context (I’m using the grid with bela).

do I need to do something to my code to get the varibright to work on a button basis? or do I need a compilation flag to enable it?