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.
Diff: main.cpp
- Revision:
- 0:3dd8497f9f22
diff -r 000000000000 -r 3dd8497f9f22 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri May 20 08:55:45 2022 +0000
@@ -0,0 +1,32 @@
+//different colour on 2 sides of sensor
+
+#include "mbed.h"
+#include "TSISensor.h"
+
+PwmOut red(LED1);
+PwmOut blue(LED3);
+
+int main() {
+ TSISensor tsi;
+ while(1) {
+ if (tsi.readPercentage())
+ {
+ if (tsi.readDistance() > 20)
+ {
+ blue = 1;
+ red = 0;
+ wait(0.1);
+ }
+ else
+ {
+ red = 1;
+ blue = 0;
+ }
+ }
+ else
+ {
+ blue = 1;
+ red = 1;
+ }
+ }
+}
\ No newline at end of file