Small example using ultrasonic
Revision 1:8fafe8a483e9, committed 2017-11-22
- Comitter:
- kohlerba
- Date:
- Wed Nov 22 21:36:59 2017 +0000
- Parent:
- 0:bd7dd6e79e36
- Child:
- 2:00f96140b44b
- Commit message:
- Simple example of ssd1306 driver with adafruit
Changed in this revision
--- a/Adafruit_GFX.lib Fri Aug 11 17:36:11 2017 +0000 +++ b/Adafruit_GFX.lib Wed Nov 22 21:36:59 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/nkhorman/code/Adafruit_GFX/#7fb1d4d3525d +http://mbed.org/users/nkhorman/code/Adafruit_GFX/#8555740e27da
--- a/HCSR04.lib Fri Aug 11 17:36:11 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/aralshukaili/code/HCSR04/#0bda99bb39a4
--- a/main.cpp Fri Aug 11 17:36:11 2017 +0000
+++ b/main.cpp Wed Nov 22 21:36:59 2017 +0000
@@ -1,9 +1,6 @@
#include "mbed.h"
#include "Adafruit_SSD1306.h"
-// OLED: SDA -> Arduino Analog 4
-// SCL -> Arduino Analog 5
-
#define SSD1306_ADDRESS 0x78
// an I2C sub-class that provides a constructed default
@@ -20,7 +17,7 @@
uint8_t led_height = 64;
uint8_t led_width = 128;
-I2CPreInit gI2C(PC_1,PC_0);
+I2CPreInit gI2C(D14,D15);
Adafruit_SSD1306_I2c gOled(gI2C,PA_8,SSD1306_ADDRESS,led_height,led_width);
DigitalOut led(LED1);
@@ -34,8 +31,16 @@
led = !led;
gOled.clearDisplay();
gOled.drawPixel(0,0,WHITE);
- gOled.fillCircle(64, 42, 10, WHITE);
+ gOled.fillCircle(63, 0, 10, WHITE);
+ gOled.display();
+ wait(1);
+ gOled.clearDisplay();
+ gOled.fillCircle(63, 31, 20, WHITE);
gOled.display();
- wait(0.1);
+ wait(1);
+ gOled.clearDisplay();
+ gOled.fillCircle(63, 63, 30, WHITE);
+ gOled.display();
+ wait(1);
}
}
Bradley Kohler