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:
- HidetoN
- Date:
- 2020-01-08
- Revision:
- 0:1025ad5aabba
- Child:
- 1:632bf9a889cc
File content as of revision 0:1025ad5aabba:
#include "mbed.h"
#define ID 0x00
DigitalOut led(LED1);
Serial pc(USBTX,USBRX,115200);
//cap1
DigitalOut cap1Out(A1);
InterruptIn cap1Check(A0);
InterruptIn cap1Get(A2);
Timer t;
Timer constantTimer;//マイコン起動時間計測用タイマー
uint32_t data=0;
void checkOut()
{
t.start();
}
void get()
{
t.stop();
cap1Out=0;
data=t.read_us();
t.reset();
}
int main()
{
pc.printf("Hello!\r\n");
cap1Check.rise(&checkOut);
cap1Get.rise(&get);
while(1) {
cap1Out=1;
//ID表示
pc.printf("%x,",ID);
pc.printf("%u,",data);
pc.printf("\r\n");
wait_us(data*2);
}
}