Example #1
0
        public static void Main()
        {
            var feedId = 68475;

            var xively = new XivelyClient(apiKey: @"YOUR_KEY_HERE");

            xively.SetFeedLocation(feedId, lat: 38.90, lon: -77.26);

            xively.WriteToFeed(feedId, values: new[] {
                new XivelyDataPoint { StreamId = "x", CurrentValue = "210" },
                new XivelyDataPoint { StreamId = "y", CurrentValue = "124" },
                new XivelyDataPoint { StreamId = "z", CurrentValue = "125" }
            });
        }
Example #2
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);
        }
    }