Skip to content

Instantly share code, notes, and snippets.

@alphaville
Last active March 29, 2023 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alphaville/fc0e07dee0a79cd8d68871a832cf98f1 to your computer and use it in GitHub Desktop.
Save alphaville/fc0e07dee0a79cd8d68871a832cf98f1 to your computer and use it in GitHub Desktop.
#include <Arduino.h>
/**
* Choose the GPIO port
* Wiring:
* ESP32-GND to LED-
* ESP-G2 to LED+
*/
#define LED 2
/**
* Setup serial; Baud rate: 115200
*/
void setup_serial()
{
Serial.begin(115200);
while (!Serial)
/* wait! */;
}
void setup()
{
setup_serial(); // setup serial port
pinMode(LED, OUTPUT); // setup LED
}
void loop()
{
delay(500); // wait for 500ms
digitalWrite(LED, HIGH); // turn LED on
Serial.println("LED is ON"); // send message over serial
delay(500); // wait for 500ms
digitalWrite(LED, LOW); // turn LED off
Serial.println("LED is OFF"); // send message over serial
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment