/********************************************************************* This is an example for our Monochrome OLEDs based on SSD1306 drivers Pick one up today in the adafruit shop! ------> http://www.adafruit.com/category/63_98 This example is for a 128x64 size display using SPI to communicate 4 or 5 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution *********************************************************************/ #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> // If using software SPI (the default case): #define OLED_MOSI 9 #define OLED_CLK 10 #define OLED_DC 11 #define OLED_CS 12 #define OLED_RESET 13 Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); void setup() { Serial.begin(9600); // by default, we'll generate the high voltage from the 3.3v line internally! (neat!) display.begin(SSD1306_SWITCHCAPVCC); display.display(); // show splashscreen delay(2000); display.clearDisplay(); // clears the screen and buffer } void loop() { float depth=30.2; int time=20; int temp=10; int deco=10; //display depth display.setTextSize(1); display.setTextColor(WHITE); display.setCursor(0,0); display.clearDisplay(); display.println("depth:"); display.setTextSize(3); display.setCursor(0,10); display.println(depth,1); // display time display.setTextSize(1); display.setCursor(90,0); display.println("time:"); display.setTextSize(2); display.setCursor(90,10); display.println(time); // display temperature display.setTextSize(1); display.setCursor(90,30); display.println("temp:"); display.setTextSize(2); display.setCursor(90,40); display.println(temp); // display deco display.setTextSize(1); display.setCursor(0,40); display.println("no deco:"); display.setTextSize(2); display.setCursor(0,50); display.println(deco); display.display(); }