![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Initial commit
Revision 0:79cb894e00f4, committed 2015-09-23
- Comitter:
- bjornnijhuis
- Date:
- Wed Sep 23 12:40:53 2015 +0000
- Commit message:
- Initial commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MODSERIAL.lib Wed Sep 23 12:40:53 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/MODSERIAL/#8ef4f91813fd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Sep 23 12:40:53 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4f6c30876dfa \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/potmeter_read.cpp Wed Sep 23 12:40:53 2015 +0000 @@ -0,0 +1,43 @@ +#include "mbed.h" +#include "MODSERIAL.h" + +Ticker output; + +AnalogIn pot(A0); +DigitalOut led_r (LED_RED); +DigitalOut led_g (LED_GREEN); +DigitalOut led_b (LED_BLUE); + +MODSERIAL pc(USBTX, USBRX); +const int baudrate = 115200; // Baudrate voor seriële verbinding +const int output_rate = 1000; + +bool fn_go = false; + +void serial_output() +{ + fn_go = true; + led_r.write(false); + +} + +int main() +{ + led_r.write(true); + led_g.write(false); + led_b.write(true); + output.attach_us(&serial_output,output_rate) ; + pc.baud(baudrate); + while (true) { + led_b.write(false); + + if(fn_go) { + led_g.write(true); + float pot_val = pot.read(); + pot_val = pot_val*4 - 2; + pc.printf("Potmeter value %.2f \n",pot_val); + + fn_go = false; + } + } +} \ No newline at end of file