Member Since: November 8, 2008

Country: United Kingdom

  • I wanted to use this multiplexer to control a few servos at a time and there was a lot of stuff on the web saying that it couldn’t be done. The code below is for two servos. I’ve combined Adafruit Softservo with the mux shield code. If you have any improvements, please post here. Here is a video of it controlling 21 servos.

       /*Mux Servo - combined Muxshield with SoftServo code (public domain)
       MuxShield.cpp - Library for using Mayhew Labs' Mux Shield.
       Created by Mark Mayhew, December 29, 2012.
       Released into the public domain.
       Adafruit Softservo
        This is an ultra simple software servo driver. 
       Written by Limor Fried for Adafruit Industries, BSD license
        #include "Arduino.h"
        #include <MuxShield.h>
        MuxShield muxShield;
        uint8_t angle;
        void writeMuxServo(int b, int u, uint8_t a) {
          uint16_t micros;
          angle = a;
          micros = map(a, 0, 180, 1000, 2000);
          muxShield.digitalWriteMS(b, u, HIGH);
          muxShield.digitalWriteMS(b, u, LOW);
        void setup() {
          pinMode(13, OUTPUT);
          angle = 90;
          // reset mux
          muxShield.setMode(1, DIGITAL_OUT);
          muxShield.setMode(2, DIGITAL_OUT);
          muxShield.setMode(3, DIGITAL_OUT);
          for (int i = 0; i < 16; i++)
            muxShield.digitalWriteMS(1, i, LOW);
            muxShield.digitalWriteMS(2, i, LOW);
            muxShield.digitalWriteMS(3, i, LOW);
          writeMuxServo(1,0,90);  // reset servo
        void loop()  {
          angle += 30;
          if (angle > 180) {
            angle = 0;
          digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
          writeMuxServo(1,0,angle);  // tell servo to go to position
          writeMuxServo(1,1,180-angle);  // tell servo to go to position
          digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  • I made a little font generator for the Nokia 5110 in the processing programming language ( It allows you to convert any font and any character that you can display on the screen into a list of hex codes that can be directly used in an embedded system (I’m using msp430). Just type a character and the corresponding hex codes will be in your clipboard and you can copy them into your program. It starts with an example with the chinese character for 5. It should work on any system that can run processing (e.g. mac osx).

  • I had trouble finding information about using this module with osx and processing, so now that I have a working setup, I thought I would post my code.
    1) add RN42-0321 SPP to your bluetooth setup
    2) need to “edit serial ports” to activate it.
    3) Once you set that up, you can use this processing program to automatically activate your bluetooth connection and set command mode.
    // Processing program for connecting and getting data from RN-42
    // Steps:
    // 1) Turn on RN-42
    // 2) Start program within 60 seconds
    import processing.serial.*;
    int lf = 10; // Linefeed in ASCII
    String myString = null;
    Serial myPort; // Create object from Serial class
    int val; // Data received from the serial port
    boolean init = false;
    void setup()
    size(400, 400);
    String[] ports = Serial.list();
    String portName = “”;
    for (int i= 0;i 0) {
    myString = myPort.readStringUntil(lf);
    if (myString != null) {
    void keyPressed() {if (key == ’d') {

  • Very cool. Does anyone know about battery life?
    I’ve also made a watch with arduino and then several with 4D systems screens (which are programmable). Right now, I can get about 2 days on one charge.

No public wish lists :(