Created
March 3, 2017 21:01
-
-
Save sebassdc/3da0b90340ed2620c11cd9a70178e125 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <Adafruit_GFX.h> | |
#include <Adafruit_SSD1306.h> | |
#define OLED_RESET 4 | |
Adafruit_SSD1306 display(OLED_RESET); | |
uint16_t xval=0; | |
double senal=0; | |
int ypre=0; | |
void setup() { | |
Serial.begin(9600); | |
delay(500); | |
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!) | |
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64) | |
// init done | |
display.clearDisplay(); | |
} | |
void loop() { | |
display.setTextSize(1); | |
display.setCursor(5,0); | |
display.setTextColor(BLACK, WHITE); | |
display.print("V1"); | |
for(xval = 0; xval <= 128; xval++) { | |
senal=analogRead(A0)/16; | |
float yval =senal; | |
int x =xval; | |
int y =yval; | |
display.drawLine(x-1, ypre,x,y, WHITE); | |
ypre=y; | |
display.display(); | |
delay(1); | |
if(xval==128){display.clearDisplay(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment