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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:54d71ce98029
diff -r 000000000000 -r 54d71ce98029 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jan 23 06:56:03 2019 +0000
@@ -0,0 +1,26 @@
+#include "TPL0102.h"
+
+TPL0102 potentiometer(PB_9, PB_8); // PB_9 SDA, PB_8 SCL
+//AnalogIn analog_value(PA_0);
+Serial pc(USBTX, USBRX);
+
+int main()
+{
+ pc.printf("Start\r\n");
+ if(potentiometer.SlaveSelect(0x00, 0xC0)) { pc.printf("Not written\r\n"); }
+ else { pc.printf("written\r\n"); }
+
+ if(potentiometer.AccessControlRegister(0x40)) { pc.printf("ACR Not written\r\n"); } // Non-volatile register, x:shutdown, read non-volatile write op.
+ else { pc.printf("ACR written\r\n"); }
+
+ int i=0xC0;
+ while(1)
+ {
+ i++;
+ potentiometer.SlaveSelect(0x00, i);
+ if(i==0xff) i=0x00;
+ wait(1);
+ }
+ return 0;
+// pc.printf("%d\r\n", analog_value);
+}