![](/media/cache/profiles/a36470cf1f8e5aaf38466d65bd080699.jpg.50x50_q85.jpg)
Plays WAV file
Diff: main.cpp
- Revision:
- 3:8daf84a849e5
- Parent:
- 2:7d65a185f9a4
- Child:
- 4:a46b7a818e39
diff -r 7d65a185f9a4 -r 8daf84a849e5 main.cpp --- a/main.cpp Wed Dec 20 09:56:26 2017 +0000 +++ b/main.cpp Fri Jan 24 10:50:28 2020 +0000 @@ -8,13 +8,15 @@ (c) Craig A. Evans, University of Leeds, Jan 2016 +updated January 2020 - uses Gamepad2 peripherals + */ #include "mbed.h" // Create objects for ticker and red LED Ticker ticker; -DigitalOut red_led(LED_RED); +DigitalOut led1(PTA2); // flag - must be volatile as changes within ISR // g_ prefix makes it easier to distinguish it as global @@ -27,8 +29,9 @@ { // set-up the ticker so that the ISR it is called every 0.5 seconds ticker.attach(&timer_isr,0.5); - // the on-board RGB LED is a common anode - writing a 1 to the pin will turn the LED OFF - red_led = 1; + + // the LED is common anode - writing a 1 to the pin will turn the LED OFF + led1 = 1; while (1) { @@ -39,6 +42,8 @@ // send message over serial port - can observe in CoolTerm etc. printf("Tick \n"); // DO TASK HERE + + led1 = ! led1; }