![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
LDR test for Stage 1 Engineering at the University of York
Diff: main.cpp
- Revision:
- 1:3edadd59e1ef
- Parent:
- 0:62608d16d10f
- Child:
- 2:4dca570013d8
diff -r 62608d16d10f -r 3edadd59e1ef main.cpp --- a/main.cpp Tue Sep 29 09:55:15 2020 +0000 +++ b/main.cpp Sat Nov 21 13:37:04 2020 +0000 @@ -1,19 +1,21 @@ #include "mbed.h" +#include "UoY-utils.h" + +serial_setup(USBTX, USBRX, 9600); int main() { AnalogIn x(A0); AnalogIn y(A1); DigitalIn button(D2, PullUp); - Serial pc(USBTX, USBRX); // Loop forever... while (true) { // Always print out the X and Y values - pc.printf("x:%d y:%d\n", x.read_u16(), y.read_u16()); + printf("x:%d y:%d\n", x.read_u16(), y.read_u16()); if (button == false) { // If the button is being pressed, add a suitable message - pc.printf("\t(button pressed)\n"); + printf("\t(button pressed)\n"); } thread_sleep_for(500); }