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:
- bcostm
- Date:
- 2014-02-21
- Revision:
- 0:69ffa4abe5b6
- Child:
- 1:58b6efe82b46
File content as of revision 0:69ffa4abe5b6:
#include "mbed.h"
InterruptIn event(USER_BUTTON);
DigitalOut myled(LED1);
int go_to_sleep = 0;
void pressed()
{
printf("Button pressed\n");
go_to_sleep = !go_to_sleep;
}
int main()
{
int i = 0;
event.fall(&pressed);
while (1) {
if (go_to_sleep) {
myled = 1;
printf("%d: Entering sleep (press user button to resume)\n", i);
sleep();
//deepsleep();
//wait(0.1);
} else {
printf("%d: Running\n", i);
myled = !myled;
wait(1.0);
}
i++;
}
}