Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

tranceash

Member Since 01 Jun 2011
Offline Last Active May 03 2012 09:13 AM
-----

Topics I've Started

Arduino body movement sensor does not work

11 April 2012 - 11:58 AM

I am have a problem connecting this PIR body PIR Sensor to work.

I cant get it to detect any movement. There are 3 wires blue,white,orange. I have connected the blue to the ground pin, white wire to digitalIO pin 5 and yellow wire to the 5v pin on the netduino board.
Is this wiring correct ?

I have this code but the interrupt never fires. Has anyone played with this Arduino body movement sensor and got it to work

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace SensorTest
{
    public class Program
    {
       static OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);

        static InterruptPort port = new InterruptPort(Pins.GPIO_PIN_D5, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);
        
        public static void Main()
        {
            // write your code here
            Debug.Print("Application Start!");

            port.OnInterrupt += new NativeEventHandler(port_OnInterrupt);

            Thread.Sleep(Timeout.Infinite);


        }

        static void port_OnInterrupt(uint portId, uint state, DateTime time)
        {
            Debug.Print("Interrupt fired");

            led.Write(true);

            Thread.Sleep(1000);

            led.Write(false);

            Thread.Sleep(1000);

        }





    }
}

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.