Compare commits

..

2 Commits

3 changed files with 14 additions and 3 deletions

View File

@@ -82,7 +82,7 @@ Discord Server: [https://discord.gg/my7Gvaxj2v](https://discord.gg/my7Gvaxj2v)
| PN532 SCL | 22 | | PN532 SCL | 22 |
| TTP223 I/O | 25 | | TTP223 I/O | 25 |
**!! Achte darauf, dass am PN532 die DIP-Schalter auf I2C gestellt sind** **!! Achte darauf, dass am PN532 die DIP-Schalter auf I2C gestellt sind**
**Nutze den 3V Pin vom ESP für den Touch Sensor** **Nutze den 3V Pin vom ESP für den Touch Sensor**
![Wiring](./img/Schaltplan.png) ![Wiring](./img/Schaltplan.png)

View File

@@ -86,7 +86,7 @@ Discord Server: [https://discord.gg/my7Gvaxj2v](https://discord.gg/my7Gvaxj2v)
| PN532 SCL | 22 | | PN532 SCL | 22 |
| TTP223 I/O | 25 | | TTP223 I/O | 25 |
**!! Make sure that the DIP switches on the PN532 are set to I2C** **!! Make sure that the DIP switches on the PN532 are set to I2C**
**Use the 3V pin from the ESP for the touch sensor** **Use the 3V pin from the ESP for the touch sensor**
![Wiring](./img/Schaltplan.png) ![Wiring](./img/Schaltplan.png)

View File

@@ -15,6 +15,7 @@
bool mainTaskWasPaused = 0; bool mainTaskWasPaused = 0;
uint8_t scaleTareCounter = 0; uint8_t scaleTareCounter = 0;
bool touchSensorConnected = false;
// ##### SETUP ##### // ##### SETUP #####
void setup() { void setup() {
@@ -59,6 +60,16 @@ void setup() {
// Touch Sensor // Touch Sensor
pinMode(TTP223_PIN, INPUT_PULLUP); pinMode(TTP223_PIN, INPUT_PULLUP);
if (digitalRead(TTP223_PIN) == HIGH)
{
Serial.println("Touch Sensor is not connected");
touchSensorConnected = false;
}
else
{
Serial.println("Touch Sensor is connected");
touchSensorConnected
}
} }
@@ -100,7 +111,7 @@ void loop() {
unsigned long currentMillis = millis(); unsigned long currentMillis = millis();
// Überprüfe den Status des Touch Sensors // Überprüfe den Status des Touch Sensors
if (digitalRead(TTP223_PIN) == HIGH && currentMillis - lastButtonPress > debounceDelay) if (touchSensorConnected && digitalRead(TTP223_PIN) == HIGH && currentMillis - lastButtonPress > debounceDelay)
{ {
lastButtonPress = currentMillis; lastButtonPress = currentMillis;
scaleTareRequest = true; scaleTareRequest = true;