sensor

Committer:
noutram
Date:
Tue Nov 21 13:23:36 2017 +0000
Revision:
3:768d30157488
Parent:
2:24eb98cf2376
Child:
4:d884f14069c6
Fixed small bug

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 2:24eb98cf2376 18 AnalogIn adcIn(PA_0);
noutram 0:6f9f2e93a0be 19
noutram 3:768d30157488 20
noutram 0:6f9f2e93a0be 21 //POWER ON SELF TEST
noutram 0:6f9f2e93a0be 22 void post()
noutram 0:6f9f2e93a0be 23 {
noutram 0:6f9f2e93a0be 24 //POWER ON TEST (POT)
noutram 3:768d30157488 25 puts("ALL LEDs should be blinking");
noutram 0:6f9f2e93a0be 26 for (unsigned int n=0; n<10; n++) {
noutram 0:6f9f2e93a0be 27 redLED = 1;
noutram 0:6f9f2e93a0be 28 yellowLED = 1;
noutram 0:6f9f2e93a0be 29 greenLED = 1;
noutram 0:6f9f2e93a0be 30 wait(0.05);
noutram 0:6f9f2e93a0be 31 redLED = 0;
noutram 0:6f9f2e93a0be 32 yellowLED = 0;
noutram 0:6f9f2e93a0be 33 greenLED = 0;
noutram 0:6f9f2e93a0be 34 wait(0.05);
noutram 3:768d30157488 35 }
noutram 3:768d30157488 36
noutram 3:768d30157488 37 //Output the switch states (hold them down to test)
noutram 3:768d30157488 38 printf("SW1: %d\tSW2: %d\n\r", SW1.read(), SW2.read());
noutram 3:768d30157488 39
noutram 3:768d30157488 40 //Output the ADC
noutram 3:768d30157488 41 printf("ADC: %f\n\r", adcIn.read());
noutram 0:6f9f2e93a0be 42 }