Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MMA8451Q mbed tsi_sensor
Fork of UTCSBootcamp by
KnockAPI.h
00001 00002 #ifndef KNOCK_API_0yx22l34755 00003 #define KNOCK_API_0yx22l34755 00004 #include <MMA8451Q.h> 00005 #include "tsi_sensor.h" 00006 00007 typedef MMA8451Q Accelerometer; 00008 typedef TSIAnalogSlider TouchSensor; 00009 00010 /******************************** Init and Finish ********************************/ 00011 void init(); 00012 00013 void finish(); 00014 00015 /******************************** Timing ********************************/ 00016 00017 00018 /** Get the time in milliseconds since the last marked time 00019 */ 00020 int getTime(); 00021 00022 /** Set the marked time to the current time 00023 */ 00024 void markTime(); 00025 00026 /** Do nothing for the specified time. 00027 * @param milliseconds, Number of milliseconds to do nothing. 00028 */ 00029 void sleep(float milliseconds); 00030 00031 /******************************** INPUTS AND OUTPUTS ********************************/ 00032 00033 /** print a message 00034 * @param msg: the message to print 00035 * @param ...: variable arguments to enter into message 00036 */ 00037 void print(const char* msg, ...); 00038 00039 /** turn on/off red led 00040 * @param on: true to turn on, false to turn off 00041 */ 00042 void redLED(bool on); 00043 00044 /** turn on/off green led 00045 * @param on: true to turn on, false to turn off 00046 */ 00047 void greenLED(bool on); 00048 00049 /** turn on/off blue led 00050 * @param on: true to turn on, false to turn off 00051 */ 00052 void blueLED(bool on); 00053 00054 /** turn on/off blue led 00055 * @param red: amount of red , from 0 to 1 00056 * @param green: amount of red , from 0 to 1 00057 * @param blue: amount of red , from 0 to 1 00058 */ 00059 void setLED(float red, float green, float blue); 00060 00061 /** Turn on debugging. Prints each method call to the serial port. 00062 * @param _debug True to turn on debugging, false to turn it off. 00063 */ 00064 void setDebug(bool _debug); 00065 00066 00067 /** Get the Accelerometer object 00068 Code for the accelerometer can be found in MMA8451Q.h 00069 important functions 00070 getAccX(); 00071 getAccY(); 00072 getAccZ(); 00073 */ 00074 Accelerometer& getAccelerometer(); 00075 00076 /** Get the Serial object to interface directly with the usb port 00077 Allows: getc, putc, printf, etc 00078 Examples: char c = #Serial.getc(); 00079 */ 00080 Serial getSerialPort(); 00081 00082 #endif
Generated on Tue Jul 12 2022 20:26:16 by
1.7.2
