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:
- markschwarzer
- Date:
- 2020-10-01
- Revision:
- 1:691260bb4aa3
- Parent:
- 0:cc0c210616de
File content as of revision 1:691260bb4aa3:
#include "mbed.h"
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalIn switch_input(p17);
Serial pc(USBTX, USBRX);
//change
int main() {
while(1) {
if (switch_input==1) {
led2= 0;
led1= 1;
wait(1);
led1= 0;
wait(1);
}
else if (switch_input==0) {
led1= 0;
led2= 1;
wait(0.3);
led2= 0;
wait(0.3); }
}}
int second() {
int count = 0;
while(count< 10) {
if(switch_input== 1){
int check = switch_input;
pc.printf("DBG [%d] count: %d\r\n", switch_input.read(), count);
while(check){
if(check - switch_input== 1){
count++;
check= 0;
pc.printf("DBG [%d] count: %d\r\n", switch_input.read(), count);
}}}}
return count;}