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:
- makia
- Date:
- 2017-12-19
- Revision:
- 1:ef8b9b9fe97d
- Parent:
- 0:264924f590d2
File content as of revision 1:ef8b9b9fe97d:
#include "mbed.h"
InterruptIn button(USER_BUTTON);
Serial pc(USBTX, USBRX); //TX, RX
DigitalOut led(LED1);
double delay = 0.5; // 500 ms
int tamp = 0; //เอามาดูค่าที่ใช้ทดลองกดปุ่ม
void pressed()
{
delay = 0.1; // 100 ms
tamp = tamp + 1 ;
}
void led2_thread() {
while (true) {
led2 = !led2;
pc.printf("test thread\n");
wait(60);
}
}
int main()
{
// Assign functions to button
button.fall(&pressed);
button.rise(&released);
thread.start(led2_thread);
while (1) {
led = !led;
pc.printf("%d" , tamp);
wait(delay);
}
}
