Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Import required libraries
- #include <ArducamSSD1306.h> // Modification of Adafruit_SSD1306 for ESP8266 compatibility
- #include <Adafruit_GFX.h> // Needs a little change in original Adafruit library (See README.txt file)
- #include <Wire.h> // For I2C comm, but needed for not getting compile error
- // Declare Integers and Their Base values for EMF Magnitude
- int current = 0;
- int peak = 0;
- // Pin definitions
- #define OLED_RESET 7 // Pin 7 -RESET digital signal
- ArducamSSD1306 display(OLED_RESET); // FOR I2C
- void setup(void)
- {
- // Start Serial
- Serial.begin(115200);
- // SSD1306 Init
- display.begin(); // Switch OLED
- // Clear the buffer.
- display.clearDisplay();
- display.setTextSize(1);
- display.setTextColor(WHITE);
- for(;;)
- {
- display.setCursor(10,2);
- display.println("EMF Detector v1");
- // This is supposed to create some ghetto animating effect but it's broken
- display.setCursor(10,15);
- int i = 1;
- i+1;
- while(i/3==1)
- {
- display.println("....");
- }
- while(i/3!=1)
- {
- display.println("...");
- }
- display.setCursor(10,25);
- display.println("Current: ");
- display.setCursor(80,25);
- display.print(current);
- display.setCursor(10,45);
- display.println("Peak: ");
- display.setCursor(80,45);
- display.print(peak);
- display.display();
- delay(500);
- display.clearDisplay();
- }
- }
- void loop()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement