UT CS Bootcamp code for creating a secret knock

Dependencies:   MMA8451Q mbed tsi_sensor

Fork of UTCSBootcamp by Clare Coleman

main.cpp

Committer:
parnell
Date:
2014-08-22
Revision:
11:0ac08d8a296f
Parent:
10:351ba1920e42

File content as of revision 11:0ac08d8a296f:

#include "mbed.h"       // mbed 
//#include <stdarg.h>
#include <MMA8451Q.h>   // accelerometer
#include <stdlib.h>     // abs
#include <math.h>       // sqrt
#include "KnockAPI.h"   // our api

#define ELEC0 9
#define ELEC1 10
/** Get the TouchSensor object
        Code for the touch sensor can be found in tsi_sensor.h
        important functions
        readPercentage(); //returns where the "touch" is,
            the touch is a value between [0 ... 1]
            0 represents no touch, greater than 0 to 1 from left to right
  */
TSIAnalogSlider ts(ELEC0, ELEC1, 40);

int main(void) {
      init(); /// call the base inits
    /*  uncomment to see print traces from all API functions 
        (you will need to use your serial port for this) */
//    setDebug(true); 

    /**
        Code for the accelerometer can be found in MMA8451Q.h
        important functions
        accelerometer.getAccX();
        accelerometer.getAccY();
        accelerometer.getAccZ();
    */
    Accelerometer accelerometer = getAccelerometer(); 
    /// Your code begins here
    while(true) { /* <-- you can change this loop as well */
        /* your code here */
    }

    finish(); /// call the base finish
}