Big thanks to members hooked up and to bliptronics for help working out the input from my iphone.

/* Code to read the Spectrum Analyzer chip from bliptronics.com
* http://www.bliptronics.com/item.aspx?ItemID=116
*
* Important: Connect a wire from the 3.3v to the ahref on the shield to work with netduino.
*
* * Based on code from bliptronics.com and arduino community assistance.
* Port by: Joseph Francis
*/
using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;
namespace BlipSpectrumAnalyzer
{
public class Program
{
static OutputPort spStrobe = new OutputPort(Pins.GPIO_PIN_D12, false);
static OutputPort spReset = new OutputPort(Pins.GPIO_PIN_D13, false);
static OutputPort redled = new OutputPort(Pins.GPIO_PIN_D1, false);
static OutputPort greenled = new OutputPort(Pins.GPIO_PIN_D2,false);
static OutputPort blueled = new OutputPort(Pins.GPIO_PIN_D3, false);
static TimeSpan ts = new TimeSpan();
static int beatCount;
static int color;
static AnalogInput spReadL = new AnalogInput(Pins.GPIO_PIN_A0);
static AnalogInput spReadR = new AnalogInput(Pins.GPIO_PIN_A1);
static bool music = false;
const int MUSIC_MIN = 190;
static Thread t = new Thread(new ThreadStart(light));
static public void setupSpecrum()
{
spReset.Write(true);
Thread.Sleep(1);
spReset.Write(false);
Thread.Sleep(1);
beatCount = 0;
color = 0;
}
static public void readSpecrum()
{
byte Band;
for (Band = 0; Band < 7; Band++)
{
//--- Trigger strobe to make multiplexer jump
spStrobe.Write(true);
spStrobe.Write(false);
if (Band == 0)
{
int cVal = spReadL.Read();
cVal += spReadR.Read();
cVal /= 2;
Debug.Print(cVal.ToString());
if (cVal < MUSIC_MIN && ((Utility.GetMachineTime()-ts) > new TimeSpan(0, 0, 5) || ts.Equals(new TimeSpan())))
{
t = new Thread(new ThreadStart(light));
t.Start();
Thread.Sleep(454);
}
else if (cVal > 800)
{
if (!t.IsAlive)
{
t = new Thread(new ThreadStart(light));
t.Start();
ts = Utility.GetMachineTime();
}
}
else
{
Debug.Print(Utility.GetMachineTime().ToString());
if ((ts - Utility.GetMachineTime()) > new TimeSpan(0, 0, 5))
{
beatCount = 0;
}
}
}
}
}
public static void light()
{
switch (color)
{
case 0:
Debug.Print("RED TICK " + beatCount);
redled.Write(true);
beatCount++;
Thread.Sleep(125);
redled.Write(false);
break;
case 1:
Debug.Print("GREEN TICK " + beatCount);
greenled.Write(true);
beatCount++;
Thread.Sleep(125);
greenled.Write(false);
break;
case 2:
Debug.Print("BlUE TICK " + beatCount);
blueled.Write(true);
beatCount++;
Thread.Sleep(125);
blueled.Write(false);
break;
};
if (beatCount == 4)
{
beatCount = 0;
color++;
if (color == 3)
{
color = 0;
}
}
}
public static void Main()
{
setupSpecrum();
while (true)
{
readSpecrum();
}
}
}
}











