Program allows for a rectangle displayed on SSD1306-based OLED display to be moved by x- and y-axis uisng two user potentiometers.

Dependencies:   mbed Adafruit_GFX

Revision:
0:befb557584fb
Child:
1:2363995f603f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Mar 20 23:28:31 2016 +0000
@@ -0,0 +1,48 @@
+/* Scan I2C bus on specified pins and prints out
+* the address of all pins where a active responder
+* is found. 
+*
+* By Joe Elsworth CTO of A2WH
+* Free use for al but no warranty, no promises.
+* Don't forget 3K pullup sda,scl */
+
+#include "mbed.h"
+
+
+Serial pc(USBTX, USBRX);
+
+ #define D_SDA                  PB_7 // specific for Nucleo-F303K8
+ #define D_SCL                  PB_6 
+   // sda=PB7, scl=PB_6 Pins specific to Nucleo-F303K8
+  // must change pins to match your board.
+
+I2C i2c(D_SDA, D_SCL);  
+  
+DigitalOut myled(LED1);
+ 
+void scanI2C() {
+  int address;
+  int ack;  
+  for(address=1;address<127;address++) {    
+    ack = i2c.write(address, "11", 1);
+    if (ack == 0) {
+       pc.printf("\tFound at %3d -- %3x\r\n", address,address);
+    }    
+    wait(0.05);
+  } 
+}
+ 
+int main() {
+  pc.baud(9600);
+  pc.printf("I2C scanner \r\n");
+  scanI2C();
+  pc.printf("Finished Scan\r\n");
+  
+  ack = i2c.write(71, "11", 1);
+   
+  while(1) { 
+      wait(5.0);          
+      myled = !myled;
+  }
+}
+ 
\ No newline at end of file