diff --git a/ampel-firmware.ino b/ampel-firmware.ino
index afd975fd7b7bd499278b8f60a0e072c832721b50..d068d825bd8957b99bef32319d7d5aa9f3e8ab2b 100644
--- a/ampel-firmware.ino
+++ b/ampel-firmware.ino
@@ -102,7 +102,7 @@ void setup() {
 
   csv_writer::initialize();
 
-#ifdef LORAWAN
+#if defined(LORAWAN) && defined(ESP32)
   lorawan::initialize();
 #endif
 }
@@ -112,7 +112,7 @@ void setup() {
  *****************************************************************/
 
 void loop() {
-#ifdef LORAWAN
+#if defined(LORAWAN) && defined(ESP32)
   //LMIC Library seems to be very sensitive to timing issues, so run it first.
   lorawan::process();
 
diff --git a/co2_sensor.cpp b/co2_sensor.cpp
index 5271cd2cf3e52bef58a503ceb992bed176c31003..51d1997035763169aa6a23e738e4204cfcfdc78d 100644
--- a/co2_sensor.cpp
+++ b/co2_sensor.cpp
@@ -183,7 +183,7 @@ namespace sensor {
       mqtt::publishIfTimeHasCome(timestamp, co2, temperature, humidity);
 #endif
 
-#ifdef LORAWAN
+#if defined(LORAWAN) && defined(ESP32)
       lorawan::preparePayloadIfTimehasCome();
 #endif
     }