public static void Main() { var peach = new Peach(); var ipAddress = NetworkUtility.InitNetwork(); if (ipAddress == "0.0.0.0") { Debug.Print("InitNetwork Failed"); return; } using (var request = WebRequest.Create(new Uri("http://www.microsoft.com/ja-jp")) as HttpWebRequest) { request.Method = "GET"; using (var response = request.GetResponse() as HttpWebResponse) { if (response.StatusCode == HttpStatusCode.OK) { var resContentBytes = new byte[(int)response.ContentLength]; using (var ress = response.GetResponseStream()) { ress.Read(resContentBytes, 0, (int)response.ContentLength); var resContentChars = Encoding.UTF8.GetChars(resContentBytes); var resContent = new string(resContentChars); Debug.Print(resContent); } peach.PulseDebugLed(100, 5); } } } Thread.Sleep(3000); }
public Program() { _peach = new Peach(); _peach.Button.ButtonPressed += Button_ButtonPressed; _peach.Button.ButtonReleased += Button_ButtonReleased; }
public static void Main() { _peach = new Peach(); _peach.Button.ButtonPressed += Button_ButtonPressed; Debug.Print("Test Started"); while (true) { } }
private void Run() { _peach = new Peach(); _peach.Button.ButtonPressed += Button_ButtonPressed; _sensor = new AnalogSensor(Cpu.AnalogChannel.ANALOG_0); _sensor.MeasurementComplete += _sensor_MeasurementComplete; _sensor.Interval = 1000; _testTimer = new Timer(PollingMeasure, null, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 1)); while (true) { } }
private void Run() { _peach = new Peach(); _peach.Button.ButtonPressed += Button_ButtonPressed; _sensor = (new SensorBoard()).Terminal; _sensor.MeasurementComplete += _sensor_MeasurementComplete; _sensor.Interval = 1000; _testTimer = new Timer(PollingMeasure, null, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 1)); while (true) { } }
private void Run() { _peach = new Peach(); _peach.Button.ButtonPressed += Button_ButtonPressed; _accelerometer = (new SensorBoard()).Accelerometer; _accelerometer.MeasurementRange = Accelerometer.Range.FourG; _accelerometer.MeasurementComplete += _accelerometer_MeasurementComplete; _accelerometer.Interval = 1000; _testTimer = new Timer(PollingMeasure, null, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 1)); while (true) { } }
private void Run() { var accel = new Adxl345 { MeasurementRange = Adxl345.Range.FourG }; _peach = new Peach(); _peach.Button.ButtonPressed += Button_ButtonPressed; ; _accelerometer = new Adxl345 { MeasurementRange = Adxl345.Range.FourG }; _accelerometer.MeasurementComplete += _accelerometer_MeasurementComplete; _accelerometer.Interval = 1000; _testTimer = new Timer(PollingMeasure, null, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 1)); while (true) { } }
public static void Main() { _peach = new Peach(); while (true) { if (_peach.Button.IsPressed) { _peach.SetDebugLed(true); Debug.Print("Button Pressed"); } else { _peach.SetDebugLed(false); Debug.Print("Button Released"); } Thread.Sleep(200); } }