esp8266_marauder.ino 924 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // the setup function runs once when you press reset or power the board
  2. void setup() {
  3. Serial.begin(115200);
  4. delay(100);
  5. // initialize digital pin LED_BUILTIN as an output.
  6. pinMode(LED_BUILTIN, OUTPUT);
  7. digitalWrite(LED_BUILTIN, HIGH);
  8. }
  9. // the loop function runs over and over again forever
  10. void loop() {
  11. //digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
  12. //delay(1000); // wait for a second
  13. //digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
  14. //delay(1000); // wait for a second
  15. if (Serial.available()) {
  16. String input = Serial.readString();
  17. input.trim();
  18. if (input == "PING") {
  19. Serial.println("ESP8266 Pong");
  20. digitalWrite(LED_BUILTIN, LOW);
  21. delay(1);
  22. digitalWrite(LED_BUILTIN, HIGH);
  23. }
  24. //Serial.println(input);
  25. }
  26. else
  27. delay(1);
  28. }