commit dd7c82e6b2466df59734732b3af2242a166ce62c Author: kekskurse Date: Fri Feb 18 12:48:04 2022 +0100 Init diff --git a/Fritzing/with-display.fzz b/Fritzing/with-display.fzz new file mode 100644 index 0000000..192d681 Binary files /dev/null and b/Fritzing/with-display.fzz differ diff --git a/Fritzing/with-display_Schaltplan.png b/Fritzing/with-display_Schaltplan.png new file mode 100644 index 0000000..66afb17 Binary files /dev/null and b/Fritzing/with-display_Schaltplan.png differ diff --git a/arduino/sample/sample.ino b/arduino/sample/sample.ino new file mode 100644 index 0000000..1b8f8fc --- /dev/null +++ b/arduino/sample/sample.ino @@ -0,0 +1,58 @@ + +#include +#include +#include + +#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) +Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1); + +int i = 10; + +void setup() { + pinMode(18, OUTPUT); //Foczs + pinMode(19, OUTPUT); //Auslöser + Serial.begin(115200); + + if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64 + Serial.println(F("SSD1306 allocation failed")); + for(;;); + } + delay(2000); + display.clearDisplay(); + + display.setTextSize(1); + display.setTextColor(WHITE); + display.setCursor(0, 10); + // Display static text + display.println("Hello, world!"); + display.setCursor(0, 20); + display.println("Hello, world!"); + display.display(); +} + +void foto() { + digitalWrite(18, HIGH); + delay(300); + digitalWrite(19, HIGH); + delay(100); + digitalWrite(18, LOW); + digitalWrite(19, LOW); +} + +void loop() { + if(i < 0){ + foto(); + i = 10; + } + display.clearDisplay(); + display.setCursor(0, 10); + display.println("Take a Picture in"); + display.setCursor(0, 20); + display.println(String(i) + " Secounds"); + display.display(); + i = i - 1; + delay(1); +}