Rapid Prototyping Analog circuitry without a multimeter or an Oscilloscope

As per below

Using Arduino Due to Rapid Prototype Analog circuitry without a multimeter or an oscilloscope

* Abstract
I wanted to control the illumination intensity of various LEDs using an amplifier.
I used a rapid prototyping approach to quickly iterate over amplifier designs without the use of either detailed analysis or multimeters, oscilloscopes etc.

* Approach
The basic idea is to use the Arduino Due's 14 ADC's to monitor test points in the circuit.
In particular, 12 bit counters with a variable delays in the main loop are used to drive the DACs.
Iterating to 4095 (sort of) lets me drives my circuit(s) with every range of input.
The DAC's analog outputs are used to drive the analog circuits under test.
Test points in the analog circuit are monitored with A0-A13 (the ADCs).
The monitored test points are Serial.printed in CSV format and cut/pasted into an OpenOffice Spreadsheet.
This produces the rough equivalent of an oscilloscope trace for the driving waveform and all test points.

* Implementation
The variables: experimentName, probeName, separator, pin are redefined for every new amplifier configuration.
experimentName - text string identifying the circuit under test.  This is printed out at the beginning of the run so that I can cut and paste it along with the rest of the output data into a spreadsheet.  I've generated a lot of traces, so tagging them is critical.
probeName - Name of the test point in the circuit.  "Bottom Transistor Collector" is a better name than "A7" since A7 may be used to monitor different things in different circuits.
separator - used to print CSV record
pin - pin used to monitor.

* Caveats
My circuit runs at Khz speeds, so there are no High speed issues (ringing, etc.) and I can log results using Serial I/O.
Higher speed circuits need to do something else.
I did not have to do anything special to keep from blowing out the ADCs since the circuit only requires voltages between ground and 3.3 V.

paseman - Anyone can use this for whatever they want

// number of items in an array
#define NUMITEMS(arg) ((unsigned int) (sizeof (arg) / sizeof (arg [0])))

// A0 is connected to Ground via a 220 ohm resistor (10K works too) as discussed here: 
// http://forum.arduino.cc/index.php?topic=182446.0
int myAnalogRead(int pin) {int dummy = analogRead(0); return analogRead(pin);}

// Loopback: One 10K resistor between DAC0 and A7
//String probeName[] = {"ADC7","ADC8","ADC9","ADC10","ADC11"};
//String separator[] = {",",",",",",",","\n"};
//unsigned int pin[] = {7,8,9,10,11};

String experimentName = "\nDac Red Amplifier Configurations";
String probeName[] = {"ADC7-Collector","ADC8-Base","ADC9-DAC0"};
String separator[] = {",",",","\n"};
unsigned int pin[] = {7,8,9};

unsigned int LED[] = {2,3,4};
unsigned int state[] = {LOW,HIGH,HIGH};

void setup() {
  analogWriteResolution(12);  // set the analog output resolution to 12 bit (4096 levels)
  analogReadResolution(12);   // set the analog input resolution to 12 bit 
  for (int i  = 0; i < NUMITEMS(LED); i++) {
    pinMode(LED[i], OUTPUT); //sets the digital pin as output
    digitalWrite(LED[i], state[i]);

  if ((NUMITEMS(probeName) != NUMITEMS(separator)) || (NUMITEMS(separator) != NUMITEMS(pin))) Serial.print(experimentName+"ERROR\n");
  Serial.print(experimentName+"\nDAC Output,");
  for (int i  = 0; i < NUMITEMS(pin); i++) Serial.print(probeName[i]+separator[i]);


int targetDac = DAC0;
int msStepDelay = 1;  // setting to 1 makes it cycle every 4 seconds
int DacLevel = 0;
void loop() {
  // put your main code here, to run repeatedly: 
    analogWrite(targetDac, DacLevel);
    Serial.print(String(DacLevel) + ",");
    for (int i  = 0; i < NUMITEMS(pin); i++) Serial.print(myAnalogRead(pin[i])+separator[i]);
    if(++DacLevel >= 4096) DacLevel = 0; // Reset the counter to repeat the ramp

This was posted to support "Using Arduino Due's DAC0 to create a variable intensity LED driver".