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.
Diff: main.cpp
- Revision:
- 2:302216e564bf
- Parent:
- 1:76d11e984b8d
--- a/main.cpp Sun Oct 04 16:23:47 2020 +0000
+++ b/main.cpp Tue Oct 11 13:38:14 2022 +0000
@@ -3,16 +3,24 @@
//Created: S. Licht, 10/04/2020
#include "mbed.h"
Ticker tickerLED2; //creat ticker object
+InterruptIn switch1(p5);
DigitalOut LEDOut2(LED2);
+DigitalOut LEDOut4(LED4);
void changeLED2() //the function that will be called by the ticker object.
{
LEDOut2 = !LEDOut2;
}
+void changeLED4() //the function that will be called by the ticker object.
+{
+ LEDOut4 = !LEDOut4;
+}
+
+
int main()
{
- tickerLED2.attach(&changeLED2,0.2); //the address of the function to call
+ tickerLED2.attach(&changeLED2,0.5); //the address of the function to call
//and the interval in seconds between
//calls to that function
@@ -20,8 +28,10 @@
wait(0.1);
wait(0.1);
wait(0.1);
- wait(0.1);
- wait(0.1);
- //the main loop is spinning every 500ms, but the LED needs to go faster!
+ //the main loop is spinning every 300ms, but the LED needs to go faster!
+
} //while
+
+ switch1.rise(&changeLED4);
+
}