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.
Diff: main.cpp
- Revision:
- 13:e3089b058fab
- Parent:
- 12:1c7b59097090
--- a/main.cpp Mon Dec 19 17:47:06 2016 +0000
+++ b/main.cpp Mon Dec 19 18:54:01 2016 +0000
@@ -1,53 +1,16 @@
#include "mbed.h"
#include "model.h"
-#include "structures.h"
#include "Serial.h"
-#include "MMA8451Q.h"
-#define MMA8451_I2C_ADDRESS (0x1d<<1)
-#define ON 0
-#define OFF !ON
-//Setup the interrupts for the MMA8451Q
-InterruptIn accInt1(PTA14);
-InterruptIn accInt2(PTA15);//not used in this prog but this is the other int from the accelorometer
-uint8_t togstat=0;//Led status
-DigitalOut bled(LED_BLUE);
+
Serial pc(USBTX,USBRX);
Model *mModel=new Model(&pc);
-char breakEm[1];
-char watchDog[1];
-void tapTrue(void){
- if(togstat == 0){
- breakEm[0]=0x01;
-// mModel->sendPacket(0xa0,0xf,0x00,breakEm,1);
- togstat = 1;
- bled=ON;
- } else if(togstat==1){
- breakEm[0]=0x00;
- /*deaktivacia brzdy*/
-// mModel->sendPacket(0xa0,0xf,0x00,breakEm,1);
-// mModel->sendPacket(0xa0,0xfe,0x00,watchDog,1);
-
- togstat = 2;
- bled=OFF;
- }else {
- togstat=0;
- watchDog[0]=0x01;
-
- bled=ON;}
-
-}
int main()
{
-
- MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);//accelorometer instance
-
- acc.setDoubleTap();//Setup the MMA8451Q to look for a double Tap
- accInt1.rise(&tapTrue);//call tapTrue when an interrupt is generated on PTA14
-
+
while(1) {
- mModel->doSomething(0x59);
+ mModel->doSomething();
};
}
\ No newline at end of file