#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "SGMeter.h"
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// The pins for I2C are defined by the Wire-library.
// On an arduino UNO: A4(SDA), A5(SCL)
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
// On an arduino LEONARDO: 2(SDA), 3(SCL), ...
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
unsigned int val[7];
byte i;
void setup()
{
Serial.begin(9600);
oled.begin(SSD1306_EXTERNALVCC, SCREEN_ADDRESS);
}
unsigned long t_start = 0;
void loop()
{
/* general */
oled.clearDisplay();
val[3] = map(analogRead(A0), 0, 1023, 0, 100);
/* creates meters */
//meter1(&oled, val, 76);
//meter2(&oled, val, 38);
//meter3(&oled, val, 0);
//meter3(&oled, val, 127-37);
//meter4(&oled, val, 38);
//meter5(&oled, val, 38);
meter6(&oled, val[3]);
//t_start = ( t_start == 0) ? millis() : t_start;
//circle_anim(&oled, t_start);
/* render the image to the display */
oled.display();
delay(20);
}