public static void Run () { var scope = new DebugScope (); //scope.UpdatePeriod.Value = 1; var accel = new Memsic2125 (); accel.XPwmInput.ConnectTo (new DigitalInputPin (Pins.GPIO_PIN_D6).Output); accel.YPwmInput.ConnectTo (new DigitalInputPin (Pins.GPIO_PIN_D7).Output); scope.ConnectTo (accel.XAccelerationOutput); scope.ConnectTo (accel.YAccelerationOutput); var compass = new Grove3AxisDigitalCompass (); scope.ConnectTo (compass.XGaussOutput); scope.ConnectTo (compass.YGaussOutput); scope.ConnectTo (compass.ZGaussOutput); var a0 = new AnalogInputPin (AnalogChannels.ANALOG_PIN_A0); scope.ConnectTo (a0.Analog); var sharp = new SharpGP2D12 (); a0.Analog.ConnectTo (sharp.AnalogInput); scope.ConnectTo (sharp.DistanceOutput); var therm = new Thermistor (); therm.AnalogInput.ConnectTo (a0.Analog); scope.ConnectTo (therm.Temperature); var b = new CelsiusToFahrenheit (); therm.Temperature.ConnectTo (b.Celsius); scope.ConnectTo (b.Fahrenheit); var bmp = new Bmp085 (); scope.ConnectTo (bmp.Temperature); var b2 = new CelsiusToFahrenheit (); bmp.Temperature.ConnectTo (b2.Celsius); scope.ConnectTo (b2.Fahrenheit); for (; ; ) { Debug.Print ("Tick"); Thread.Sleep (1000); } }
public static void Main() { // A debug scope allows us to listen to a block (in this case the // accelerometer), and automatically write its output to the console. DebugScope scope = new DebugScope (); scope.UpdatePeriod.Value = .5; // update 2x/second // create a new instance of the Memsic2125 class Memsic2125 accelerometer = new Memsic2125 (); // connect the acceleromter outputs to the output through pins 11 and 12 accelerometer.XPwmInput.ConnectTo (new DigitalInputPin (Pins.GPIO_PIN_D11).Output); accelerometer.YPwmInput.ConnectTo (new DigitalInputPin (Pins.GPIO_PIN_D12).Output); // connect our scope the acceleromter output scope.ConnectTo (accelerometer.XAccelerationOutput); scope.ConnectTo (accelerometer.YAccelerationOutput); // keep the program alive while (true) { Thread.Sleep(1000); Debug.Print("Waiting a second."); } }