예제 #1
0
    static void Main()
    {
        const int samplingPeriod = 6000;   // 6 seconds

        var voltagePort = new AnalogInput(Parameters.AnalogPin);
        var lowPort     = new OutputPort(Parameters.LowPin, false);
        var highPort    = new OutputPort(Parameters.HighPin, true);

        voltagePort.Scale = 3.3;                    // convert to Volt

        while (true)
        {
            WaitUntilNextPeriod(samplingPeriod);
            double value  = voltagePort.Read();
            string sample = "voltage," + value.ToString("f");
            Debug.Print("new message: " + sample);
            XivelyClient.Send(Parameters.ApiKey, Parameters.FeedId, sample);
        }
    }