UT CS Bootcamp code for creating a secret knock

Dependencies:   MMA8451Q mbed tsi_sensor

Fork of UTCSBootcamp by Clare Coleman

Committer:
parnell
Date:
Fri Aug 22 19:52:08 2014 +0000
Revision:
11:0ac08d8a296f
Parent:
10:351ba1920e42
Revised with touch sensor;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
parnell 9:0ba1973c3bd3 1
parnell 9:0ba1973c3bd3 2 #ifndef KNOCK_API_0yx22l34755
parnell 9:0ba1973c3bd3 3 #define KNOCK_API_0yx22l34755
parnell 9:0ba1973c3bd3 4 #include <MMA8451Q.h>
parnell 11:0ac08d8a296f 5 #include "tsi_sensor.h"
parnell 9:0ba1973c3bd3 6
parnell 9:0ba1973c3bd3 7 typedef MMA8451Q Accelerometer;
parnell 11:0ac08d8a296f 8 typedef TSIAnalogSlider TouchSensor;
parnell 9:0ba1973c3bd3 9
parnell 9:0ba1973c3bd3 10 /******************************** Init and Finish ********************************/
parnell 9:0ba1973c3bd3 11 void init();
parnell 9:0ba1973c3bd3 12
parnell 9:0ba1973c3bd3 13 void finish();
parnell 9:0ba1973c3bd3 14
parnell 9:0ba1973c3bd3 15 /******************************** Timing ********************************/
parnell 9:0ba1973c3bd3 16
parnell 9:0ba1973c3bd3 17
parnell 9:0ba1973c3bd3 18 /** Get the time in milliseconds since the last marked time
parnell 9:0ba1973c3bd3 19 */
parnell 9:0ba1973c3bd3 20 int getTime();
parnell 9:0ba1973c3bd3 21
parnell 9:0ba1973c3bd3 22 /** Set the marked time to the current time
parnell 9:0ba1973c3bd3 23 */
parnell 9:0ba1973c3bd3 24 void markTime();
parnell 9:0ba1973c3bd3 25
parnell 9:0ba1973c3bd3 26 /** Do nothing for the specified time.
parnell 9:0ba1973c3bd3 27 * @param milliseconds, Number of milliseconds to do nothing.
parnell 9:0ba1973c3bd3 28 */
parnell 9:0ba1973c3bd3 29 void sleep(float milliseconds);
parnell 9:0ba1973c3bd3 30
parnell 9:0ba1973c3bd3 31 /******************************** INPUTS AND OUTPUTS ********************************/
parnell 9:0ba1973c3bd3 32
parnell 9:0ba1973c3bd3 33 /** print a message
parnell 9:0ba1973c3bd3 34 * @param msg: the message to print
parnell 9:0ba1973c3bd3 35 * @param ...: variable arguments to enter into message
parnell 9:0ba1973c3bd3 36 */
parnell 9:0ba1973c3bd3 37 void print(const char* msg, ...);
parnell 9:0ba1973c3bd3 38
parnell 9:0ba1973c3bd3 39 /** turn on/off red led
parnell 9:0ba1973c3bd3 40 * @param on: true to turn on, false to turn off
parnell 9:0ba1973c3bd3 41 */
parnell 9:0ba1973c3bd3 42 void redLED(bool on);
parnell 9:0ba1973c3bd3 43
parnell 9:0ba1973c3bd3 44 /** turn on/off green led
parnell 9:0ba1973c3bd3 45 * @param on: true to turn on, false to turn off
parnell 9:0ba1973c3bd3 46 */
parnell 9:0ba1973c3bd3 47 void greenLED(bool on);
parnell 9:0ba1973c3bd3 48
parnell 9:0ba1973c3bd3 49 /** turn on/off blue led
parnell 9:0ba1973c3bd3 50 * @param on: true to turn on, false to turn off
parnell 9:0ba1973c3bd3 51 */
parnell 9:0ba1973c3bd3 52 void blueLED(bool on);
parnell 9:0ba1973c3bd3 53
parnell 11:0ac08d8a296f 54 /** turn on/off blue led
parnell 11:0ac08d8a296f 55 * @param red: amount of red , from 0 to 1
parnell 11:0ac08d8a296f 56 * @param green: amount of red , from 0 to 1
parnell 11:0ac08d8a296f 57 * @param blue: amount of red , from 0 to 1
parnell 10:351ba1920e42 58 */
parnell 11:0ac08d8a296f 59 void setLED(float red, float green, float blue);
parnell 10:351ba1920e42 60
parnell 9:0ba1973c3bd3 61 /** Turn on debugging. Prints each method call to the serial port.
parnell 9:0ba1973c3bd3 62 * @param _debug True to turn on debugging, false to turn it off.
parnell 9:0ba1973c3bd3 63 */
parnell 9:0ba1973c3bd3 64 void setDebug(bool _debug);
parnell 9:0ba1973c3bd3 65
parnell 9:0ba1973c3bd3 66
parnell 9:0ba1973c3bd3 67 /** Get the Accelerometer object
parnell 11:0ac08d8a296f 68 Code for the accelerometer can be found in MMA8451Q.h
parnell 11:0ac08d8a296f 69 important functions
parnell 11:0ac08d8a296f 70 getAccX();
parnell 11:0ac08d8a296f 71 getAccY();
parnell 11:0ac08d8a296f 72 getAccZ();
parnell 9:0ba1973c3bd3 73 */
parnell 11:0ac08d8a296f 74 Accelerometer& getAccelerometer();
parnell 9:0ba1973c3bd3 75
parnell 9:0ba1973c3bd3 76 /** Get the Serial object to interface directly with the usb port
parnell 9:0ba1973c3bd3 77 Allows: getc, putc, printf, etc
parnell 9:0ba1973c3bd3 78 Examples: char c = #Serial.getc();
parnell 9:0ba1973c3bd3 79 */
parnell 9:0ba1973c3bd3 80 Serial getSerialPort();
parnell 9:0ba1973c3bd3 81
parnell 9:0ba1973c3bd3 82 #endif