As the title says... Chat on...

User avatar
By 1314258
#61630
marcelstoer wrote:
devsaurus wrote:I guess that there are too many inaccuracies when doing this from Lua.


We've had and example in our repo at https://github.com/nodemcu/nodemcu-firm ... irsend.lua for quite some time but I have no idea whether that still works.


i don't know other people,but i tested it,it doesnot work in my situation.
User avatar
By Erhannis
#87959 I've lost track of whether we're using Lua or C or what, but this code (C, I believe, compiled from Arduino Studio) yields a ~5.5MHz on/off cycle, according to the oscilloscope that just arrived in the mail.

Code: Select all#define PIN_OUT        D1
#define PIN 1<<5

void setup()
{
  ESP.wdtDisable();

  pinMode( PIN_OUT, OUTPUT );
  digitalWrite( PIN_OUT, LOW );
}

void loop() {
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TS_ADDRESS, PIN);
  GPIO_REG_WRITE(GPIO_OUT_W1TC_ADDRESS, PIN);
}