public static void Main() { // HUMIDITY & TEMPERATURE // ---------------------- var RHT03 = new Dht22Sensor(Pins.GPIO_PIN_D0, Pins.GPIO_PIN_D1, PullUpResistor.Internal); Thread.Sleep(2000); WebServer w = new WebServer(80, 10000); w.Start(); w.CommandReceived += delegate(object o, WebServer.WebServerEventArgs e) { //WebServer.OutPutStream(e.response, e.rawURL); if (RHT03.Read()) { var temperatureCelsius = RHT03.Temperature; var humidity = RHT03.Humidity; string answer = "DHT Sensor: RH = " + humidity.ToString("F1") + "% Temp = " + temperatureCelsius.ToString("F1") + "°C "; Debug.Print(answer); WebServer.OutPutStream(e.response, answer); } }; // INFRA RED // --------- //// Declare our remote control input pin RC_In.OnInterrupt += new NativeEventHandler(RC_In_OnInterrupt); //// Set the RC6 decoder's input pin to the one we just declared, and create an event handler for the code. //RC6_Decoder.RemoteInputPin = RC_In; //RC6_Decoder.CodeReceived += new CodeReceivedEventHandler(RC6_Decoder_CodeReceived); // NEC //var necRemoteControlDecoder = new NecProtocolDecoder(Pins.GPIO_PIN_D7); NecProtocolDecoder.RemoteInputPin = RC_In; NecProtocolDecoder.OnIRCommandReceived += necRemoteControlDecoder_OnIrCommandReceived; // LOOP INFINITO // ------------- while (true) { //if (RHT03.Read()) //{ // var temperatureCelsius = RHT03.Temperature; // var humidity = RHT03.Humidity; // Debug.Print("DHT sensor Read() ok, RH = " + humidity.ToString("F1") + "%, Temp = " + temperatureCelsius.ToString("F1") + "°C " + (temperatureCelsius * 1.8 + 32).ToString("F1") + "°F"); //} // Thread.Sleep(2000); } //var RHT03 = new TemperatureSensor(Cpu.AnalogChannel.ANALOG_0); //var temp = RHT03.Temperature; }
public static void Main() { var RHT03 = new Dht22Sensor(Pins.GPIO_PIN_D0, Pins.GPIO_PIN_D1, PullUpResistor.Internal); Thread.Sleep(2000); while (true) { if (RHT03.Read()) { var temperatureCelsius = RHT03.Temperature; var humidity = RHT03.Humidity; Debug.Print("DHT sensor Read() ok, RH = " + humidity.ToString("F1") + "%, Temp = " + temperatureCelsius.ToString("F1") + "°C " + (temperatureCelsius * 1.8 + 32).ToString("F1") + "°F"); } Thread.Sleep(2000); } //var RHT03 = new TemperatureSensor(Cpu.AnalogChannel.ANALOG_0); //var temp = RHT03.Temperature; }
public static void Main() { var RHT03 = new Dht22Sensor(Pins.GPIO_PIN_D0, Pins.GPIO_PIN_D1, PullUpResistor.Internal); Thread.Sleep(2000); WebServer w = new WebServer(80, 10000); w.Start(); w.CommandReceived += delegate(object o, WebServer.WebServerEventArgs e) { //WebServer.OutPutStream(e.response, e.rawURL); if (RHT03.Read()) { var temperatureCelsius = RHT03.Temperature; var humidity = RHT03.Humidity; string answer = "DHT Sensor: RH = " + humidity.ToString("F1") + "% Temp = " + temperatureCelsius.ToString("F1") + "°C "; Debug.Print(answer); WebServer.OutPutStream(e.response, answer); } }; while (true) { //if (RHT03.Read()) //{ // var temperatureCelsius = RHT03.Temperature; // var humidity = RHT03.Humidity; // Debug.Print("DHT sensor Read() ok, RH = " + humidity.ToString("F1") + "%, Temp = " + temperatureCelsius.ToString("F1") + "°C " + (temperatureCelsius * 1.8 + 32).ToString("F1") + "°F"); //} // Thread.Sleep(2000); } //var RHT03 = new TemperatureSensor(Cpu.AnalogChannel.ANALOG_0); //var temp = RHT03.Temperature; }