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
main.cpp
00001 #include "mbed.h" // mbed 00002 //#include <stdarg.h> 00003 #include <MMA8451Q.h> // accelerometer 00004 #include <stdlib.h> // abs 00005 #include <math.h> // sqrt 00006 #include "KnockAPI.h" // our api 00007 00008 #define ELEC0 9 00009 #define ELEC1 10 00010 /** Get the TouchSensor object 00011 Code for the touch sensor can be found in tsi_sensor.h 00012 important functions 00013 readPercentage(); //returns where the "touch" is, 00014 the touch is a value between [0 ... 1] 00015 0 represents no touch, greater than 0 to 1 from left to right 00016 */ 00017 TSIAnalogSlider ts(ELEC0, ELEC1, 40); 00018 00019 int main(void) { 00020 init(); /// call the base inits 00021 /* uncomment to see print traces from all API functions 00022 (you will need to use your serial port for this) */ 00023 // setDebug(true); 00024 00025 /** 00026 Code for the accelerometer can be found in MMA8451Q.h 00027 important functions 00028 accelerometer.getAccX(); 00029 accelerometer.getAccY(); 00030 accelerometer.getAccZ(); 00031 */ 00032 Accelerometer accelerometer = getAccelerometer(); 00033 /// Your code begins here 00034 while(true) { /* <-- you can change this loop as well */ 00035 /* your code here */ 00036 } 00037 00038 finish(); /// call the base finish 00039 }
Generated on Tue Jul 12 2022 20:26:16 by
1.7.2
