The ESP8266 can yield a 163 kHZ wave using the Arduino IDE and writing the code in C.  The code used is:

int pin = 5;
void setup() {
  pinMode(pin, OUTPUT);
}
void loop() {
  digitalWrite(pin, HIGH);
  digitalWrite(pin, LOW);
}

Nevertheless the wave form is far from being square as show on the picture below.  Click on the picture to enlarge it.

ESP8266 generated wave In C

By adding a 5 uS delay, we get a pretty good square wave.  The frequency is then 85.6 kHZ.  The code used is:

int pin = 5;
void setup() {
  pinMode(pin, OUTPUT);
}
void loop() {
  digitalWrite(pin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pin, LOW);
}

The yielded wave form is given below.  Click on the picture to enlarge it.

ESP8266 generated wave In C with correction

The frequency is 60 times higher than running a similar code on the ESP8266 with NodeMCU.

Leave comment

Your email address will not be published. Required fields are marked with *.

Time limit is exhausted. Please reload the CAPTCHA.