O'Reilly logo

Netduino Home Automation Projects by Matt Cavanagh

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

Coding

Because we will be using a phone to connect to the Netduino, there are two distinct parts which need to be coded.

The Netduino code

  1. Open up Visual Studio and create a new Netduino Plus 2 Application.
  2. Just like in the previous chapters, add a reference to SecretLabs.NETMF.Hardware.PWM.
  3. Open Program.cs from the Solution Explorer. You need to add the following using statements at the top:
    using System.IO.Ports;
    using System.Text;
    using NPWM = SecretLabs.NETMF.Hardware.PWM;
  4. You need to get the phone paired with the Bluetooth module on the Netduino. So in Program.cs, replace the Main method with this:
     private static SerialPort _bt; public static void Main() { _bt = new SerialPort(SerialPorts.COM1, 9600, Parity.None, 8, StopBits.One); _bt.Open(); while ...

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