LDR test for Stage 1 Engineering at the University of York

Dependencies:   UoY-serial

Files at this revision

API Documentation at this revision

Comitter:
ajp109
Date:
Mon Sep 20 13:44:21 2021 +0000
Parent:
3:01b95e6267d8
Commit message:
Initial commit for LDR test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show diff for this revision Revisions of this file
diff -r 01b95e6267d8 -r 390669f57ccc main.cpp
--- a/main.cpp	Thu Sep 16 19:57:31 2021 +0000
+++ b/main.cpp	Mon Sep 20 13:44:21 2021 +0000
@@ -2,18 +2,11 @@
 
 int main()
 {
-    AnalogIn x(A0);
-    AnalogIn y(A1);
-    DigitalIn button(D2, PullUp);
+    AnalogIn light(A0);
 
     // Loop forever...
     while (true) {
-        // Always print out the X and Y values
-        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
-             printf("\t(button pressed)\n");
-        }
+        printf("Raw light level: %d\n", light.read_u16());
         thread_sleep_for(500);
     }
 }
diff -r 01b95e6267d8 -r 390669f57ccc mbed_app.json
--- a/mbed_app.json	Thu Sep 16 19:57:31 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-{
-    "target_overrides": {
-        "*": {
-            "target.printf_lib": "std"
-        }
-    }
-}