diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..5170b2e --- /dev/null +++ b/README.MD @@ -0,0 +1,16 @@ +## Kabelbelegung 3D Drucker RFID: ## + +Steckerpin Farbe Beschreibung (Pin am LCD/Adrino) +1,2 Rot, Orange: +5V (5V) +3 Grau (unused) +4 Weiss (pin A0) +5 Rosa (pin 10) +6 Braunweiss (oder Baby Blau bei Display seite) (pin 8) +7 Braun (pin 7) +8 Lila (pin 5) +9 Blau (pin 4) +10 Gruen (pin 6) +11 Gelb (pin 9) +12 Türkis (unused) +13,14 Schwarz, Schwarzweiss: GND (GND) + diff --git a/T11_RFID_Tutorial_Sketch/T11_RFID_Tutorial_Sketch.ino b/T11_RFID_Tutorial_Sketch/T11_RFID_Tutorial_Sketch.ino index 76210f8..939d962 100644 --- a/T11_RFID_Tutorial_Sketch/T11_RFID_Tutorial_Sketch.ino +++ b/T11_RFID_Tutorial_Sketch/T11_RFID_Tutorial_Sketch.ino @@ -1,8 +1,15 @@ +//#define PRINTER //uncomment for 3d-Printer (cooldown functions) + #include #include #include #include +#ifdef PRINTER + #define BTN_FANPROBE A3 + #define FANOFFVALUE 50 //adc value for fan + boolean flag_switchOff = false; //set true-> loop switches output off if possible +#endif #define BTN_PIN A0 // lcd buttons are Voltage-Divider analog #define LCD_BACKLIGHT 10 @@ -40,6 +47,7 @@ int displayCardsIndex = -1; int displayCardsIndexLast = -1; boolean cardsshow=false; + void setup() { pinMode(10, OUTPUT); // LCD backlight pinMode(A4, OUTPUT); // relais 1 @@ -159,8 +167,20 @@ void handleCards(long currentMillis) { } else { // if we are locked, we switch out Output - if(outputOn) { - set_output(false); + if(outputOn) { + #ifdef PRINTER + if (!flag_switchOff){ + flag_switchOff=true; + lcd.clear(); + lcd.print("Wartet auf"); + lcd.setCursor(0, 1); + lcd.print("Luefter"); + }else{ + flag_switchOff=false; //cancel switchoff + } + #else + set_output(false); + #endif } else { add_log(&(mfrc522.uid)); set_output(true); @@ -214,6 +234,7 @@ void loop() { handleCards(currentMillis); + if(readButtons() == 1 && !cardsshow) { //select button shows log, if not showing cards atm displayLogIndex++; displayLogIndex %= 10; @@ -295,6 +316,40 @@ void loop() { lcd_print_home(); } } + + #ifdef PRINTER + int fanvalue=analogRead(BTN_FANPROBE); + Serial.println(fanvalue); + if (flag_switchOff){ + if (readButtons()!=0){ //any buttons pressed + abortSwitchoff(); + } + if (!fanActive()){ + set_output(false); + flag_switchOff=false; + } + } + #endif } +#ifdef PRINTER +bool fanActive() +{ + int fanvalue=analogRead(BTN_FANPROBE); + Serial.println(fanvalue); + if (fanvalue