Beispiel #1
0
        private void BtnRead_Click(object sender, EventArgs e)
        {
            double ret;
            int    tempint;

            string[] directions = new string[] { "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE",
                                                 "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW" };
            short[] winddir = new short[6];
            try
            {
                /* READ TEMPERATURE INDOOR */
                ret = ws2300.temperature_indoor(config.temperature_conv);
                Display("TEMP in=" + ret.ToString());
                /* READ TEMPERATURE OUTDOOR */
                ret = ws2300.temperature_outdoor(config.temperature_conv);
                Display("TEMP out=" + ret.ToString());
                /* READ DEWPOINT */
                ret = ws2300.dewpoint(config.temperature_conv);
                Display("Dew point=" + ret.ToString());
                /* READ RELATIVE HUMIDITY INDOOR */
                ret = ws2300.humidity_indoor();
                Display("HUM in=" + ret.ToString());
                /* READ RELATIVE HUMIDITY OUTDOOR */
                ret = ws2300.humidity_outdoor();
                Display("HUM out=" + ret.ToString());
                /* READ WIND SPEED AND DIRECTION */
                tempint    = -1;
                winddir[0] = 0xFFF;
                ret        = ws2300.wind_all(config.wind_speed_conv_factor, ref tempint, ref winddir);
                Display("Wind=" + ret.ToString() + " dir:" + winddir[0].ToString() + "° " + directions[tempint]);
                //sprintf(logline, "%s%.1f %s ", logline, winddir[0], directions[tempint]);
                /* READ WINDCHILL */
                ret = ws2300.windchill(config.temperature_conv);
                Display("Windchill=" + ret.ToString());
                /* READ RAIN 1H */
                ret = ws2300.rain_1h(config.rain_conv_factor);
                Display("RAIN 1h=" + ret.ToString());
                /* READ RAIN 24H */
                ret = ws2300.rain_24h(config.rain_conv_factor);
                Display("RAIN 24h=" + ret.ToString());
                /* READ RAIN TOTAL */
                ret = ws2300.rain_total(config.rain_conv_factor);
                Display("RAIN tot=" + ret.ToString());
                /* READ RELATIVE PRESSURE */
                ret = ws2300.rel_pressure(config.pressure_conv_factor);
                Display("PRESS rel=" + ret.ToString());
                /* READ TENDENCY AND FORECAST */
                string tendency = "";
                string forecast = "";
                ws2300.tendency_forecast(ref tendency, ref forecast);
                Display("   tendency=" + tendency);
                Display("   forecast=" + forecast);
            }
            catch (Exception ex)
            {
                Display("ERROR: " + ex.Message);
            }
            Display("");
        }