ECE 4180 Lab 3 Part 2

Dependencies:   mbed

Fork of Ticker_HelloWorld by mbed official

Committer:
abraha2d
Date:
Tue Oct 16 00:23:53 2018 +0000
Revision:
1:adae4a00fbfe
Parent:
0:5014bf742e9b
Save point

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:5014bf742e9b 1 #include "mbed.h"
mbed_official 0:5014bf742e9b 2
abraha2d 1:adae4a00fbfe 3 Ticker flipper1;
abraha2d 1:adae4a00fbfe 4 Ticker flipper2;
abraha2d 1:adae4a00fbfe 5 Ticker flipper3;
abraha2d 1:adae4a00fbfe 6 Ticker flipper4;
abraha2d 1:adae4a00fbfe 7
mbed_official 0:5014bf742e9b 8 DigitalOut led1(LED1);
mbed_official 0:5014bf742e9b 9 DigitalOut led2(LED2);
abraha2d 1:adae4a00fbfe 10 DigitalOut led3(LED3);
abraha2d 1:adae4a00fbfe 11 DigitalOut led4(LED4);
mbed_official 0:5014bf742e9b 12
abraha2d 1:adae4a00fbfe 13 void flip1() {
abraha2d 1:adae4a00fbfe 14 led1 = !led1;
abraha2d 1:adae4a00fbfe 15 }
abraha2d 1:adae4a00fbfe 16
abraha2d 1:adae4a00fbfe 17 void flip2() {
mbed_official 0:5014bf742e9b 18 led2 = !led2;
mbed_official 0:5014bf742e9b 19 }
mbed_official 0:5014bf742e9b 20
abraha2d 1:adae4a00fbfe 21 void flip3() {
abraha2d 1:adae4a00fbfe 22 led3 = !led3;
abraha2d 1:adae4a00fbfe 23 }
abraha2d 1:adae4a00fbfe 24
abraha2d 1:adae4a00fbfe 25 void flip4() {
abraha2d 1:adae4a00fbfe 26 led4 = !led4;
abraha2d 1:adae4a00fbfe 27 }
mbed_official 0:5014bf742e9b 28
abraha2d 1:adae4a00fbfe 29 int main() {
abraha2d 1:adae4a00fbfe 30 led1 = 0;
abraha2d 1:adae4a00fbfe 31 led2 = 0;
abraha2d 1:adae4a00fbfe 32 led3 = 0;
abraha2d 1:adae4a00fbfe 33 led4 = 0;
abraha2d 1:adae4a00fbfe 34
abraha2d 1:adae4a00fbfe 35 flipper1.attach(&flip1, 8.0); // the address of the function to be attached (flip1) and the interval (8 seconds)
abraha2d 1:adae4a00fbfe 36 flipper2.attach(&flip2, 4.0); // the address of the function to be attached (flip2) and the interval (4 seconds)
abraha2d 1:adae4a00fbfe 37 flipper3.attach(&flip3, 2.0); // the address of the function to be attached (flip3) and the interval (2 seconds)
abraha2d 1:adae4a00fbfe 38 flipper4.attach(&flip4, 1.0); // the address of the function to be attached (flip4) and the interval (1 seconds)
mbed_official 0:5014bf742e9b 39 }