Cd4051 Multiplexer Tutorial Is Here!

With the current json implemenations of pd2dsy, and the update staged for release on oopsy you can do the following, which is copied from the daisy field.json file:

"parents":
  "pot_mux": {
    "component": "CD4051",
    "mux_count": 8, // the number of pots connected
    "pin": {
      "adc": 16,  // the ADC input pin
      "sel0": 21, // The SEL0 digital output pin
      "sel1": 20, // The SEL1 digital output pin
      "sel2": 19  // The SEL2 digital output pin
    }
  }
},
"components": {
  "knob1": {
    "component": "CD4051AnalogControl",
    "index": 0, // which analog input pin on the CD4051 to read
    "parent": "pot_mux"
  },
  "knob2": {
    "component": "CD4051AnalogControl",
    "index": 3, // which analog input pin on the CD4051 to read
    "parent": "pot_mux"
  }
},

edit: updated to be more complete (using parents and components relationship).

4 Likes