-
Notifications
You must be signed in to change notification settings - Fork 18
1.3 Lab 3
#LAB 3: SENSING THE WORLD
This lab reads the current levels from the Temperature and Light Sensors.
Ensure the Netduino is connected to the PC using the USB cable and then follow these steps.
-
Review the code below. On completion of this lab, your code should be the same
-
If the program is still running from Lab 2, then click the stop button first. You will not be able to edit the Program.cs file while the code executes.
-
Follow the notes in the Lab 3 and copy and paste the code in to Program.cs
-
Press F5 or the click the Start button from the toolbar to run the code on the Netduino
-
The code will deploy to the Netduino
-
The red LED should start blinking
-
In Visual Studio press Alt+2 to switch to the Output screen. You will see the sensor data displayed in JSON format.
using Coatsy.Netduino.NeoPixel.Jewel; using Glovebox.Adafruit.Mini8x8Matrix; using Glovebox.MicroFramework.Sensors; using Glovebox.Netduino.Actuators; using Glovebox.Netduino.Sensors; using Microsoft.SPOT; using SecretLabs.NETMF.Hardware.NetduinoPlus; using System.Threading; namespace MakerDen { public class Program : MakerBaseIoT { public static void Main() { // main code marker using (SensorTemp temp = new SensorTemp(Pins.GPIO_PIN_D8, 10000, "temp01")) using (SensorLight light = new SensorLight(AnalogChannels.ANALOG_PIN_A0, 1000, "light01")) using (rgb = new RgbLed(Pins.GPIO_PIN_D3, Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D6, "rgb01")) { while (true) { Debug.Print(light.ToString()); Debug.Print(temp.ToString()); rgb.On(RgbLed.Led.Red); Thread.Sleep(500); rgb.Off(RgbLed.Led.Red); Thread.Sleep(500); } // End of while loop } } } }