Advertisement
hwthinker

Serial Test on ESP32 Dev module

Aug 6th, 2019
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Note :
  2. // pastikan opsi tools-> flash mode pilih menjdi DIO,Qout atau Dout. Jangan Pilih QIO.
  3. //the setup function runs once when you press reset or power the board
  4. // update by hwthinker
  5.  
  6. int counter = 0;
  7. int state = 0;
  8. int LED_BUILTIN=2;
  9. void setup() {
  10.   //Initialize serial and wait for port to open:
  11.   Serial.begin(9600);
  12.    // initialize digital pin LED_BUILTIN as an output.
  13.   pinMode(LED_BUILTIN, OUTPUT);
  14.   Serial.println("Test Serial and Built in LED on ESP32 by HwThinker: ");
  15.   delay(2000);
  16. }
  17.  
  18.  
  19. void loop() {
  20.    Serial.print("Test packet: ");
  21.   Serial.println(counter);
  22.   counter++;
  23.  
  24.   delay(1000);
  25.   digitalWrite(LED_BUILTIN, (state) ? HIGH : LOW);
  26.   state = !state;
  27.   //or   digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement