works

Dependencies:   SRF05 mbed

Fork of SRF05_HelloWorld by Simon Ford

Revision:
4:87d6d45092c5
Parent:
3:1b2fffffb566
Child:
5:df7cdf275ec9
diff -r 1b2fffffb566 -r 87d6d45092c5 main.cpp
--- a/main.cpp	Tue Nov 29 16:21:32 2016 +0000
+++ b/main.cpp	Tue Nov 29 19:32:11 2016 +0000
@@ -1,8 +1,13 @@
 // Simple program to read the distance from an SRF05 using the SRF05 library
 
 #include "mbed.h"
+#include "Adafruit_GFX.h"
+#include "Adafruit_SSD1306.h"
 #include "SRF05.h"
 
+SPIPreInit Gspi(p5, p6, p7);
+SPI spi(p5, p6, p7);
+Adafruit_SSD1306_Spi ssd(spi, p5, p6, p7);
 SRF05 srf(p9, p10);
  
 int main() { 
@@ -14,7 +19,8 @@
      while(1) { 
          curval = srf.read();
          percentage = 100-((curval-5)/range)*100;
-         printf ("Percentage Remaining: %.0f (%.0f)\n\r", percentage, curval);             
+         printf ("P,V: %.0f (%.0f)\n\r", percentage, curval);
+         ssd.printf ("P,V: %.0f (%.0f)\n\r", percentage, curval);            
          wait(0.2); 
      } 
  } 
\ No newline at end of file