Advertisement
Guest User

EMF Detector on arduCam ssd1306 oled

a guest
Jun 19th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Import required libraries
  2. #include <ArducamSSD1306.h>    // Modification of Adafruit_SSD1306 for ESP8266 compatibility
  3. #include <Adafruit_GFX.h>   // Needs a little change in original Adafruit library (See README.txt file)
  4. #include <Wire.h>           // For I2C comm, but needed for not getting compile error
  5.  
  6. // Declare Integers and Their Base values for EMF Magnitude
  7. int current = 0;
  8. int peak = 0;
  9.  
  10. // Pin definitions
  11. #define OLED_RESET  7  // Pin 7 -RESET digital signal
  12.  
  13. ArducamSSD1306 display(OLED_RESET); // FOR I2C
  14.  
  15.  
  16. void setup(void)
  17. {
  18. // Start Serial
  19. Serial.begin(115200);
  20.  
  21.   // SSD1306 Init
  22.   display.begin();  // Switch OLED
  23.   // Clear the buffer.
  24.   display.clearDisplay();
  25.   display.setTextSize(1);
  26.   display.setTextColor(WHITE);
  27.  
  28.   for(;;)
  29.   {
  30.   display.setCursor(10,2);
  31.   display.println("EMF Detector v1");
  32.  
  33.   // This is supposed to create some ghetto animating effect but it's broken
  34.   display.setCursor(10,15);
  35.   int i = 1;
  36.   i+1;
  37.   while(i/3==1)
  38.   {
  39.     display.println("....");
  40.   }
  41.  
  42.   while(i/3!=1)
  43.   {
  44.     display.println("...");
  45.   }
  46.  
  47.   display.setCursor(10,25);
  48.   display.println("Current: ");
  49.   display.setCursor(80,25);
  50.   display.print(current);
  51.  
  52.   display.setCursor(10,45);
  53.   display.println("Peak: ");
  54.   display.setCursor(80,45);
  55.   display.print(peak);
  56.  
  57.   display.display();
  58.   delay(500);
  59.   display.clearDisplay();
  60.   }
  61.  
  62. }
  63.  
  64. void loop()
  65. {
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement