#include “DaisyDuino.h”
DaisyHardware patch;
#define analogPin0 PIN_PATCH_SM_A2 // ADC_9 - works
// #define analogPin0 PIN_PATCH_SM_C5 // C5
#define pinS3 PIN_PATCH_SM_D4 // Pin D4
#define pinS2 PIN_PATCH_SM_D3 // Pin D3
#define pinS1 PIN_PATCH_SM_D2 // Pin D2
#define pinS0 PIN_PATCH_SM_D1 // Pin D1
void setup()
{
/** Initialize the patch_sm hardware object */
patch = DAISY.init(DAISY_PATCH_SM);
Serial.begin(9600);
//Set pins D0, D1, and D2 as digital outs
pinMode(pinS3, OUTPUT);
pinMode(pinS2, OUTPUT);
pinMode(pinS1, OUTPUT);
pinMode(pinS0, OUTPUT);
}
void loop()
{
//Only reading input 0 of the multiplexer
digitalWrite(pinS3, LOW);
digitalWrite(pinS2, LOW);
digitalWrite(pinS1, LOW);
digitalWrite(pinS0, LOW);
Serial.print(analogRead(analogPin0));
Serial.print(" ");
//Only reading input 1 of the multiplexer
digitalWrite(pinS3, LOW);
digitalWrite(pinS2, LOW);
digitalWrite(pinS1, LOW);
digitalWrite(pinS0, HIGH);
Serial.print(analogRead(analogPin0));
Serial.print(" ");
//Only reading input 2 of the multiplexer
digitalWrite(pinS3, LOW);
digitalWrite(pinS2, LOW);
digitalWrite(pinS1, HIGH);
digitalWrite(pinS0, LOW);
Serial.print(analogRead(analogPin0));
Serial.print(" ");
//Only reading input 3 of the multiplexer
digitalWrite(pinS3, LOW);
digitalWrite(pinS2, LOW);
digitalWrite(pinS1, HIGH);
digitalWrite(pinS0, HIGH);
Serial.print(analogRead(analogPin0));
Serial.print(" ");
//Only reading input 4 of the multiplexer
digitalWrite(pinS3, LOW);
digitalWrite(pinS2, HIGH);
digitalWrite(pinS1, LOW);
digitalWrite(pinS0, LOW);
Serial.print(analogRead(analogPin0));
Serial.print(" ");
//Only reading input 5 of the multiplexer
digitalWrite(pinS3, LOW);
digitalWrite(pinS2, HIGH);
digitalWrite(pinS1, LOW);
digitalWrite(pinS0, HIGH);
Serial.print(analogRead(analogPin0));
Serial.print(" ");
//Only reading input 6 of the multiplexer
digitalWrite(pinS3, LOW);
digitalWrite(pinS2, HIGH);
digitalWrite(pinS1, HIGH);
digitalWrite(pinS0, LOW);
Serial.print(analogRead(analogPin0));
Serial.print(" ");
//Only reading input 7 of the multiplexer
digitalWrite(pinS3, LOW);
digitalWrite(pinS2, HIGH);
digitalWrite(pinS1, HIGH);
digitalWrite(pinS0, HIGH);
Serial.println(analogRead(analogPin0));
delay(200);
}