#include #include #include "RTClib.h" //adafruit time lib Bounce button2 = Bounce(2, 10); Bounce button3 = Bounce(3, 10); // RTC_DS1307 rtc; void setup() { pinMode(2, INPUT_PULLUP); pinMode(3, INPUT_PULLUP); Serial.begin(57600); Wire.begin(); rtc.begin(); if (! rtc.isrunning()) { // Serial.println("RTC is NOT running!"); // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(__DATE__, __TIME__)); } } void neu(); void save(uint32_t unix_time); int dtime=200; void loop() { //delay(150); uint32_t unix_time = rtc.now().unixtime(); //Serial.println(unix_time); button2.update(); button3.update(); if (button2.fallingEdge()) { neu(); } if (button3.fallingEdge()) { save(unix_time); } } void neu(){ Keyboard.press(MODIFIERKEY_CTRL); Keyboard.press(KEY_N); delay(dtime); Keyboard.release(MODIFIERKEY_CTRL); Keyboard.release(KEY_N); delay(dtime); Keyboard.press(KEY_TAB); // delay(dtime); Keyboard.release(KEY_TAB); Keyboard.press(KEY_ENTER); //delay(dtime); Keyboard.release(KEY_ENTER); delay(dtime); } void save(uint32_t unix_time){ Keyboard.press(MODIFIERKEY_CTRL); Keyboard.press(KEY_S); delay(dtime); Keyboard.release(MODIFIERKEY_CTRL); Keyboard.release(KEY_S); delay(dtime); Keyboard.print("img/"); Keyboard.print(unix_time); Keyboard.print(".png"); //Keyboard.press(KEY_TAB); // delay(dtime); Keyboard.release(KEY_TAB); Keyboard.press(KEY_ENTER); //delay(dtime); Keyboard.release(KEY_ENTER); delay(dtime); neu(); }