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:
- 0:264924f590d2
- Child:
- 1:ef8b9b9fe97d
File content as of revision 0:264924f590d2:
#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 released() { delay = 0.5; // 500 ms pc.printf("tamp stable = %d " , tamp); } int main() { // Assign functions to button button.fall(&pressed); button.rise(&released); while (1) { led = !led; pc.printf("%d" , tamp); wait(delay); } }