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 Servo mbed
Revision 3:c8e9a933acd2, committed 2016-02-26
- Comitter:
- fdopc
- Date:
- Fri Feb 26 16:22:10 2016 +0000
- Parent:
- 2:d07fe9f3d109
- Commit message:
- zx
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Feb 26 16:15:53 2016 +0000
+++ b/main.cpp Fri Feb 26 16:22:10 2016 +0000
@@ -6,16 +6,16 @@
#if defined (TARGET_KL25Z) || defined (TARGET_KL46Z)
- PinName const SDA = PTE25;
- PinName const SCL = PTE24;
+PinName const SDA = PTE25;
+PinName const SCL = PTE24;
#elif defined (TARGET_KL05Z)
- PinName const SDA = PTB4;
- PinName const SCL = PTB3;
+PinName const SDA = PTB4;
+PinName const SCL = PTB3;
#elif defined (TARGET_K20D50M)
- PinName const SDA = PTB1;
- PinName const SCL = PTB0;
+PinName const SDA = PTB1;
+PinName const SCL = PTB0;
#else
- #error TARGET NOT DEFINED
+#error TARGET NOT DEFINED
#endif
#define MMA8451_I2C_ADDRESS (0x1d<<1)
@@ -36,7 +36,7 @@
{
float TSILec;
float x, y, z;
- MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS);
+ MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS);
PwmOut red(LED_RED);
PwmOut green(LED_GREEN);
PwmOut blue(LED_BLUE);
@@ -45,7 +45,7 @@
while (true) {
//Check Touch Press
- if(tsi.readPercentage()>0.001) {
+ if(tsi.readPercentage()>0.01) {
TSILec=tsi.readPercentage();
if(TSILec<0.25) {
red=1;
@@ -69,9 +69,9 @@
}
Motor1=TSILec; //Assign touch read to motor
wait(0.1);
- }
- //Read Accel
- else{
+ }
+ //Read Accel
+ else {
x=acc.getAccX();
y=acc.getAccY();
z=acc.getAccZ();