sensor

Committer:
noutram
Date:
Tue Nov 21 11:36:19 2017 +0000
Revision:
2:24eb98cf2376
Parent:
1:3250ba797c16
Child:
3:768d30157488
ADC now sampled in a thread and NOT ISR

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 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 }