Categories: Uncategorized

Motion sensing with FEZ Domino

Just messing around with my new FEZ Domino board and I thought I’d post up a quick tutorial on how to use a motion sensor with your board. First thing you will want to understand is interrupt ports. An interrupt port is a port that is listening and waiting for something to happen. For instance voltage levels going up or going down. In this tutorial I use a motion sensor that I got from parallax here. This is a very basic sensor that has voltage tolerance of 3-5v and has one pin that outputs high or low voltage levels. High means its sensed motion. The next part of this project involves a small speaker that outputs a tone to let you know its sensed motion. Nothing loud or anything but just for demonstration purpose. You can get the driver for the tone generation here: http://www.tinyclr.com/downloads/Component/FEZ_Components_Piezo.cs. So here’s the code:
#region motion sensor
            Thread.Sleep(30000);

            tone = new FEZ_Components.Piezo(FEZ_Pin.PWM.Di5);
            InterruptPort motion = new InterruptPort((Cpu.Pin)FEZ_Pin.Interrupt.Di1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeHigh);
            motion.OnInterrupt += new NativeEventHandler(motion_OnInterrupt);

            Thread.Sleep(-1);
#endregion

static void motion_OnInterrupt(uint data1, uint data2, DateTime time)
        {
            tone.Play(400, 1000);
        }
ronhks

Recent Posts

Mac TimeMachine drive on Samba share

First, create a Samba share on the easiest way. For example, mine: [macbook-pro-14] path =…

2 years ago

oh-my-zsh p10k git branch name shortened

I use this and I experiened like this: The branch name is shortened and can't…

2 years ago

Intellij IDEA Golang own package problem

I really like IDEA for developing. I worked on a golang project and I organised…

3 years ago

Run MiniDLNA from docker

For reusage: docker run -d \-p 8200:8200 \--restart=on-failure:3 \--name minidlna \-v /opt/minidlna/cache:/minidlna/cache \-v /mnt/data/series:/media/series \-v…

3 years ago

Docker img ipv6 problem

On my host the ipv6 is disabled. I had to start a docker image, which…

3 years ago

Gentoo USB serial passthrough KVM

I have a Conbee II Zigbee receiver. After a restart the USB passthrought stopped working…

3 years ago

This website uses cookies.