Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 2:87c34bb330c2, committed 2018-11-29
- Comitter:
- ADIJake
- Date:
- Thu Nov 29 12:43:39 2018 +0000
- Parent:
- 1:59475336cb66
- Commit message:
- Comparator for the Lazer maze game;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 59475336cb66 -r 87c34bb330c2 main.cpp --- a/main.cpp Mon Jan 08 18:19:51 2018 +0000 +++ b/main.cpp Thu Nov 29 12:43:39 2018 +0000 @@ -26,14 +26,16 @@ //array of digital channels DigitalOut doutChannels[CHANNEL_COUNT] = {Dout0, Dout1, Dout2, Dout3, Dout4}; +Serial pc(PA_11, PA_12); int main() { //read value of analog channels float meas; - + pc.printf("Hello World !\n"); //calibrate to ambient light, adding offset to find the thresholds for(int i = 0; i < CHANNEL_COUNT; i++) { initialValues[i] = (ainChannels[i].read() * 3300) + OFFSET; + //pc.printf("initial %d = %.0f mV\n", i, initialValues[i]); } while(1) { @@ -42,7 +44,7 @@ //find channels current value meas = ainChannels[i].read(); // Converts and read the analog input value (value from 0.0 to 1.0) meas = meas * 3300; // Change the value to be in the 0 to 3300 range - printf("measure %d = %.0f mV\n", i, meas); + pc.printf("measure %d = %.0f mV\n", i, meas); if (meas > initialValues[i]) { // If the value is greater than 2V then switch the LED on doutChannels[i] = 1; }