Version1
Dependencies: MP3_TF_16P mbed
Revision 0:3bcb41e0da86, committed 2022-01-25
- Comitter:
- JeroenAero
- Date:
- Tue Jan 25 19:26:40 2022 +0000
- Commit message:
- Version1;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LAS-TB.lib Tue Jan 25 19:26:40 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/JeroenAero/code/MP3_TF_16P/#4697650da797
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jan 25 19:26:40 2022 +0000 @@ -0,0 +1,58 @@ +#include "mbed.h" +#include "LAS_TB.h" + +Serial pc(USBTX, USBRX); // tx, rx + +//initialize mp3 player. +LAS_TB LaserSensor(D1,D0); + +DigitalOut TeKlein(D6); +DigitalOut Goed(D7); +DigitalOut TeGroot(D8); + +double millimeters = 0; + +int main() +{ + + pc.baud(9600); + + pc.printf("Opstarten!\r\n"); + + wait(1); + + while(1) + { + wait(2); //Om de 2 seconden uitvoeren. + + LaserSensor.MeasurementRequest(); + wait(0.5); //Halve sec wachten tot meting binnen is. + + //uitlezen. + millimeters = (double)LaserSensor.umvalue/1000.0f; + + pc.printf("millimeters: %f\r\n", millimeters); + + if (millimeters < 49.95f) + { + TeKlein = true; + Goed = false; + TeGroot = false; + pc.printf("Te klein!\r\n"); + } + else if (millimeters > 51.05f) + { + TeKlein = false; + Goed = false; + TeGroot = true; + pc.printf("Te groot!\r\n"); + } + else + { + TeKlein = false; + Goed = true; + TeGroot = false; + pc.printf("Goed!\r\n"); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jan 25 19:26:40 2022 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file