George Kartsonas
Published

Netduino for Posture Correction

Do you ever wonder if you're doing exercises correctly or if you have good posture? Well, Netduino is here to help.

BeginnerFull instructions provided1 hour566
Netduino for Posture Correction

Things used in this project

Hardware components

Netduino3
Wilderness Labs (Netduino) Netduino3
×1
9V battery (generic)
9V battery (generic)
×1
Analog Accelerometer: ADXL335
Adafruit Analog Accelerometer: ADXL335
×1
RGB Diffused Common Cathode
RGB Diffused Common Cathode
×1

Software apps and online services

Visual Studio 2015
Microsoft Visual Studio 2015

Story

Read more

Schematics

RGB LED and Accelerometer Connections

Code

C# Armduino Code

C#
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace Analog_Test
{
    public class Program
    {
        static OutputPort ledr = new OutputPort(Pins.GPIO_PIN_D13, false);
        static OutputPort ledg = new OutputPort(Pins.GPIO_PIN_D12, false);

        public static void Main()
        {
            AnalogInput a5 = new AnalogInput(AnalogChannels.ANALOG_PIN_A0);

            while (true)
            {
                string s = a5.Read().ToString();
                Debug.Print(s);
                Thread.Sleep(100);
                Double i = a5.Read();

                if (i < 0.42)
                {
                ledr.Write(true);
                Thread.Sleep(250); // sleep for 250ms
                ledr.Write(false); // turn off the LED
                Thread.Sleep(250); // sleep for 250ms
                }

                else 
                {
                    ledg.Write(true);
                    Thread.Sleep(250); // sleep for 250ms
                    ledg.Write(false); // turn off the LED
                    Thread.Sleep(250); // sleep for 250ms
                }

            }


        }

    }
}

Credits

George Kartsonas

George Kartsonas

13 projects • 28 followers

Comments