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:
- 0:41e22e385908
- Child:
- 1:998a963e2ead
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Dec 07 19:40:46 2016 +0000 @@ -0,0 +1,53 @@ +#include "mbed.h" +#include "model.h" +#include "structures.h" +DigitalOut cervena(LED1); +DigitalOut zelena(LED2); + +Serial pc(USBTX,USBRX); +Model *mModel =new Model(); +void SerialCallBack(); +int main() +{ + mModel->pc.baud(57600); + + mModel->pc.attach(&SerialCallBack); + testData mtest; + + mtest.data[0]=0x41; + mtest.data[1]=0x42; + mtest.data[2]=0x43; + mtest.data[3]=0x44; + mtest.startByte=0xa0; + mtest.targetAddress=0xd0; + mtest.sourceAddress=0x00; + // mModel->sendPacket(mtest.startByte,mtest.targetAddress,mtest.sourceAddress,mtest.data); + cervena=1; + zelena=1; + + + + while(1){ + mModel->pc.attach(&SerialCallBack); + mModel->doSomething(mModel->sourceAdd); + // if(mModel->sourceAdd==0xc3){ +// mModel->sendPacket(0xa0,0xd0,0x00,mModel->DataIn); +// } + }; + // mModel->sendPacket(0xa0,0xd0,0x00,mModel->DataIn); + +} + + +void SerialCallBack() +{ + + mModel->startByteIn=mModel->pc.getc(); + mModel->targetAdd=mModel->pc.getc(); + mModel->sourceAdd=mModel->pc.getc(); + mModel->DataLength=mModel->pc.getc(); + for (unsigned int i=0;i< mModel->DataLength;i++){ + mModel->DataIn[i]=mModel->pc.getc();} + mModel->CrcIn=mModel->pc.getc(); + +} \ No newline at end of file