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.
main.cpp
- Committer:
- Sainratp
- Date:
- 2017-10-23
- Revision:
- 1:5c0ca9bdf810
- Parent:
- 0:703249a56b9d
- Child:
- 2:a4a73ba6f492
File content as of revision 1:5c0ca9bdf810:
#include "mbed.h"
#include "DO/DO.h"
#include "MO/MO.h"
#include "rtos.h"
#include "config.h"
DigitalOut led1(LED1);
DigitalOut out(PIN_OUT);
InterruptIn in(PIN_IN);
Serial pc(USBTX,USBRX);
char test[5]={0x01,0x01,0x01,0x01,0x01};
Thread sendCharThread;
Thread sendDataThread;
Thread receiveBitThread;
Thread receiveCharThread;
Ticker ticker;
void interruptRise()
{
receiveBitThread.signal_set(0x01);
}
void interruptFall()
{
receiveBitThread.signal_set(0x01);
}
void wake()
{
sendCharThread.signal_set(0x01);
led1=!led1;
}
int main()
{
led1=1;
in.rise(&interruptRise);
in.fall(&interruptFall);
wait(1);
sendCharThread.start(&sendChar);
receiveBitThread.start(&receiveBit);
receiveCharThread.start(&receiveChar);
sendDataThread.start(&sendData);
ticker.attach(&wake,T/2.0);
while(1) {
createTrame(test,5);
wait(1);
}
}