Library of hardware declarations and utility functions for the ELEC350/1 Practicals and Coursework

Dependents:   ELEC351_v1 ELEC350-CWTEMPLATE-2017 ELEC350-CWTEMPLATE-2017 ELEC350-CWTEMPLATE-2018

Fork of ELEC350-Practicals-FZ429 by University of Plymouth - Stages 1, 2 and 3

Committer:
noutram
Date:
Tue Nov 14 15:15:50 2017 +0000
Revision:
1:3250ba797c16
Parent:
0:6f9f2e93a0be
Child:
2:24eb98cf2376
Update for FZ429

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noutram 0:6f9f2e93a0be 1 #include "mbed.h"
noutram 0:6f9f2e93a0be 2 #include "sample_hardware.hpp"
noutram 0:6f9f2e93a0be 3
noutram 0:6f9f2e93a0be 4 #define RED_DONE 1
noutram 0:6f9f2e93a0be 5 #define YELLOW_DONE 2
noutram 0:6f9f2e93a0be 6
noutram 0:6f9f2e93a0be 7 //Digital outputs
noutram 0:6f9f2e93a0be 8 DigitalOut onBoardLED(LED1);
noutram 0:6f9f2e93a0be 9 DigitalOut redLED(PE_15);
noutram 0:6f9f2e93a0be 10 DigitalOut yellowLED(PB_10);
noutram 0:6f9f2e93a0be 11 DigitalOut greenLED(PB_11);
noutram 0:6f9f2e93a0be 12
noutram 0:6f9f2e93a0be 13 //Inputs
noutram 0:6f9f2e93a0be 14 DigitalIn onBoardSwitch(USER_BUTTON);
noutram 0:6f9f2e93a0be 15 DigitalIn SW1(PE_12);
noutram 0:6f9f2e93a0be 16 DigitalIn SW2(PE_14);
noutram 0:6f9f2e93a0be 17 //Serial pc(USBTX, USBRX);
noutram 1:3250ba797c16 18 AnalogIn adcIn(A0);
noutram 0:6f9f2e93a0be 19
noutram 0:6f9f2e93a0be 20 //POWER ON SELF TEST
noutram 0:6f9f2e93a0be 21 void post()
noutram 0:6f9f2e93a0be 22 {
noutram 0:6f9f2e93a0be 23 //POWER ON TEST (POT)
noutram 0:6f9f2e93a0be 24 puts("TASK 616 - ALL LEDs should be blinking");
noutram 0:6f9f2e93a0be 25 for (unsigned int n=0; n<10; n++) {
noutram 0:6f9f2e93a0be 26 redLED = 1;
noutram 0:6f9f2e93a0be 27 yellowLED = 1;
noutram 0:6f9f2e93a0be 28 greenLED = 1;
noutram 0:6f9f2e93a0be 29 wait(0.05);
noutram 0:6f9f2e93a0be 30 redLED = 0;
noutram 0:6f9f2e93a0be 31 yellowLED = 0;
noutram 0:6f9f2e93a0be 32 greenLED = 0;
noutram 0:6f9f2e93a0be 33 wait(0.05);
noutram 0:6f9f2e93a0be 34 }
noutram 0:6f9f2e93a0be 35 }