Version for FZ420ZI
Fork of Task442 by
Revision 2:6c9c8dfe36e6, committed 2018-02-13
- Comitter:
- noutram
- Date:
- Tue Feb 13 11:39:11 2018 +0000
- Parent:
- 1:b0f53d2975bd
- Child:
- 3:36ab439835c7
- Commit message:
- Updated for FZ429ZI
Changed in this revision
--- a/main.cpp Thu Jul 13 14:55:06 2017 +0000
+++ b/main.cpp Tue Feb 13 11:39:11 2018 +0000
@@ -6,7 +6,8 @@
//Global objects
Serial pc(USBTX, USBRX);
AnalogIn POT_ADC_In(A0);
-DigitalOut led(LED1);
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
//Shared variables
volatile static unsigned short sample16 = 0;
@@ -20,6 +21,14 @@
//Set baud rate to 115200
pc.baud(115200);
+ //Power on self test
+ led1 = 1; led2 = 1;
+ pc.printf("TESTING\n\r");
+ wait(1.0);
+ led1 = 1; led2 = 1;
+ pc.printf("DONE\n\r");
+ wait(1.0);
+
//Set up the ticker - 100Hz
t.attach(doSample1Hz, 1.0);
@@ -28,6 +37,13 @@
//Sleep
sleep();
+ //READ ADC as an unsigned integer.
+ //Shift right 4 bits (this is a 12bit ADC) & store in static global variable
+ sample16 = POT_ADC_In.read_u16() >> 4;
+
+ //Hardware debug to verify this is working
+ led2 = !led2;
+
//Displauy the sample in HEX
pc.printf("ADC Value: %X\n", sample16);
@@ -35,13 +51,8 @@
} //end main
//ISR for the ticker - simply there to perform sampling
-void doSample1Hz()
-{
+void doSample1Hz() {
//Toggle on board led
- led = !led;
-
- //READ ADC as an unsigned integer.
- //Shift right 4 bits (this is a 12bit ADC) & store in static global variable
- sample16 = POT_ADC_In.read_u16() >> 4;
+ led1 = !led1;
}
--- a/mbed-os.lib Thu Jul 13 14:55:06 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://github.com/ARMmbed/mbed-os/#8828635da469162cf2854b5287561c663fb96e72
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Feb 13 11:39:11 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file
