O'Reilly logo

Getting Started with the Internet of Things by Cuno Pfister

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

HelloPachube

Now that your Netduino Plus is ready to access the Internet, we can look at a first version of a Pachube client. Its source code is given in Example 6-1.

Example 6-1. HelloPachube

using System;
using System.Threading;
using Gsiot.PachubeClient;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;

public class HelloPachube
{
    public static void Main()
    {
        const string apiKey = "your Pachube API key";
        const string feedId = "your Pachube feed id"; const int samplingPeriod = 20000; // 20 seconds const double maxVoltage = 3.3; const int maxAdcValue = 1023; var voltagePort = new AnalogInput(Pins.GPIO_PIN_A1); var lowPort = new OutputPort(Pins.GPIO_PIN_A0, false); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required