Skip to content

Commit 57a5b86

Browse files
committed
Fix LED example
1 parent b0c70ab commit 57a5b86

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

examples/LED/LED.ino

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
88
*/
99

10+
#include <Arduino.h>
1011
#include "Thing.h"
1112
#include "WebThingAdapter.h"
1213

1314
//TODO: Hardcode your wifi credentials here (and keep it private)
1415
const char* ssid = "public";
1516
const char* password = "";
1617

18+
#if defined(LED_BUILTIN)
1719
const int ledPin = LED_BUILTIN;
18-
19-
#ifdef ESP32
20-
ESP32WebThingAdapter adapter("esp32");
21-
#endif
22-
#ifdef ESP8266
23-
ESP8266WebThingAdapter adapter("esp8266");
20+
#else
21+
const int ledPin = 13; // manully configure LED pin
2422
#endif
2523

24+
WebThingAdapter adapter("w25");
25+
2626
ThingDevice led("led", "Built-in LED", "onOffSwitch");
2727

2828
ThingProperty ledOn("on", "", BOOLEAN);
@@ -37,7 +37,9 @@ void setup(void){
3737
Serial.print("Connecting to \"");
3838
Serial.print(ssid);
3939
Serial.println("\"");
40+
#if defined(ESP8266) || defined(ESP32)
4041
WiFi.mode(WIFI_STA);
42+
#endif
4143
WiFi.begin(ssid, password);
4244
Serial.println("");
4345

0 commit comments

Comments
 (0)