Adding Momentary Switches to Baby O

I am using the Baby O. but need pushbutton switches for control, mode and limits.

I have connected them to Baby O. pins PC0 - PC3 and ground.

The plan is to set them up as digital inputs and use the internal pull-ups and then debounce them as I haven’t added a rc filter on the buttons as of yet.

Can I use the Pololu library functions for debounce if I define the pins correctly?
Any advice would be great as I am just getting started with AVR’s and the Baby O way of doing things.

My past experience is with Microchip controllers and the manuals and doing it that way.

Thanks, Tim

Hello, Tim.

We do not have a general pushbutton library for the Orangutans that let you specify which pins the buttons are on. You could modify the OrangutanPushbuttons section of the Pololu AVR C/C++ Library and recompile it, or you could copy that code into your own project, convert it from C++ to C, and modify it there.

The easiest option would be to use the library without modifying it, but that would require you to put all the buttons on port B. Is that an option for you? I think this would work but I have not tried it.


Thanks David that’s what I thought.

Where do I find the uncompiled source files? I’ve looked but obviously not in the right places!

Thanks, Tim

They should be in C:\libpololu-avr\src if you installed the library in the default location. They are also on github.