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 Communication
- // Declare Integers and Their Base values for EMF Magnitude
- int current = 1;
- int peak = 1;
- // Pin definitions
- #define OLED_RESET 7 // Pin 7 -RESET digital signal
- // Some I2C Shit
- ArducamSSD1306 display(OLED_RESET);
- void setup(void)
- {
- // initialize digital pin LED_BUILTIN as an output. for checking loop.
- pinMode(LED_BUILTIN, OUTPUT);
- // Start Serial
- Serial.begin(115200);
- // SSD1306 Init
- display.begin(); // Switch OLED
- // Clear the buffer.
- display.clearDisplay();
- display.setTextSize(1);
- display.setTextColor(WHITE);
- }
- void loop()
- {
- // Title
- display.setCursor(10,2);
- display.println("EMF Detector v1:");
- // Divider Line
- display.setCursor(10,15);
- display.println("----------------");
- // Reading Display Current
- display.setCursor(10,25);
- display.println("Current: ");
- ///////////////////////////////////////////////
- // Output Current Reading with Variable to LED
- if(current>10)
- {
- current = 0;
- }
- else
- {
- current + 1;
- }
- display.setCursor(80,25);
- display.print(current);
- // Something gay is afoot in this shit.
- ///////////////////////////////////////////////
- display.setCursor(10,45);
- display.println("Peak: ");
- // Highest Reading Taken Appears Here as Variable on LED
- display.setCursor(80,45);
- //
- //
- display.print(peak);
- //
- //
- //
- //
- // LED for Checking Loop
- // LED On
- digitalWrite(LED_BUILTIN, HIGH);
- delay(1000);
- // LED Off
- digitalWrite(LED_BUILTIN, LOW);
- // Pass This into LED Buffer
- display.display();
- // Wait
- delay(250);
- // Clear Buffer & Repeat
- display.clearDisplay();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement