Task 3.2.1

Fork of Task321 by Nicholas Outram

Committer:
noutram
Date:
Wed Sep 11 14:37:22 2019 +0000
Revision:
2:688437caece6
Parent:
0:d9322feedf3a
2019;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noutram 0:d9322feedf3a 1 #include "mbed.h"
noutram 0:d9322feedf3a 2
noutram 0:d9322feedf3a 3 DigitalOut red_led(D7);
noutram 0:d9322feedf3a 4 DigitalOut yellow_led(D6);
noutram 0:d9322feedf3a 5 DigitalOut green_led(D5);
noutram 0:d9322feedf3a 6 DigitalIn SW1(D4);
noutram 0:d9322feedf3a 7
noutram 0:d9322feedf3a 8 int main() {
noutram 0:d9322feedf3a 9
noutram 0:d9322feedf3a 10 //Switch on Yellow and Green to indicate
noutram 0:d9322feedf3a 11 //that the code is running
noutram 0:d9322feedf3a 12 yellow_led = 1;
noutram 0:d9322feedf3a 13 green_led = 1;
noutram 0:d9322feedf3a 14 red_led = 0; //Set RED LED to OFF
noutram 0:d9322feedf3a 15
noutram 0:d9322feedf3a 16 // Wait for SW1 to be pressed
noutram 0:d9322feedf3a 17 while (SW1 == 0) { }
noutram 0:d9322feedf3a 18
noutram 0:d9322feedf3a 19 red_led = 1; //Turn ON LED
noutram 0:d9322feedf3a 20
noutram 0:d9322feedf3a 21 while (1) { } //Repeat forever
noutram 0:d9322feedf3a 22 }