• The separate second setWatch() function is missing. See the last
    function on that page and take a close look at how the 'times' array
    of pulses is sent out through the IR diode by investigating the 'Send
    the pulses' comment there.

    setWatch(function(e) {
      // stop recording
      stopWatching();
      // Light up LED1
      digitalWrite(LED1,1);
      // Start the 38kHz square wave
      analogWrite(A5,0.9,{freq:38000});
      // Send the pulses
      digitalPulse(A6, 1, times);
      // Wait until pulsing is finished
      digitalPulse(A6, 1, 0);
      // Turn LED1 off
      digitalWrite(LED1,0);
      // start recording again
      startWatching();
    }, BTN, {repeat:true, edge:"rising", debounce:50});
    

    My module also does not have LED1, BTN(please see the screenshot in post 8). Therefore, I asked the question how to adapt this piece of code to my NodeMcu Lua wifi module (https://aliexpress.ru/item/32408097207.h­tml?spm=a2g0s.9042311.0.0.1ad333ed1mlnaz­).

    Most likely, if possible, then using only this piece of code:

    // Start the 38kHz square wave
      analogWrite(A5,0.9,{freq:38000});
      // Send the pulses
      digitalPulse(A6, 1, times);
      // Wait until pulsing is finished
      digitalPulse(A6, 1, 0);
      // Turn LED1 off
    

    This can only be dealt with after it is clear how to connect the IR diode (post 8)

  • Tue 2019.12.24

    from post #4 'My module is already flashed with espruino firmware'

    Bravo, it appears success has be achieved with the flash process.

    Your post is in the correct thread under the correct heading. Maybe others are willing, but for me however;

    As I pointed out in #7 post @user107037, my choice is to provide assistance gratis to those that support the Espruino community with their purchse of official authentic supported boards.

    https://www.espruino.com/Other+Boards

    Still, in the spirit of the Holiday season . . .


    'I still have problems that I have not found answers from your posts (('

    That statement as indicated, from #5 post, the third bulleted item beneath heading 'Wiring Up' is clear and succinct.

    https://www.espruino.com/Pico+Infrared


    'My module does not have contacts A5, A6'

    It most likely wouldn't as;

    The examples and tutorials were written with the intent to further the Espruino community with fair compensation returned with the offical authentic board purchase. @allObjects had the best suggestion in his #3 post above to obtain rapid results.

    'Maybe such a connection scheme is suitable?'

    The link provided there with images has many useable suggestions. I'd pick one with the least amount of supporting components. Also, there is a hardware use case example clearly detailed in the the board purchase link #1 post, although the supporting code snippet appears to be Arduino 'C'.


    'This can only be dealt with after it is clear how to connect the IR diode'

    My suggestion would be to use a visible LED (color of your choice - and with a current limiter to protect the LED of around 220 ohms until the internal pullup concept is mastered) in place of the IR diode, and use a simple command to illuminate that LED. When satisfied with that task, replace with the IR one. If the circuit still doesn't work, then maybe the IR diode is in backwards, or at worst damamged.

    The easiest command to toggle a GPIO pin is:

    https://www.espruino.com/Reference#l__gl­obal_digitalWrite

    along with many in use examples.



    To assist the others;

    @user107037 is the struggle with the connectivity and placement of the parts, the understanding of the electrical characteristics of IR diodes and current flow, how to re-write code in 'C' for Arduino using Javascript with Espruino, mastering the commands of the Javascript language or deciphering the datasheet of the microcontroller?

About

Avatar for Robin @Robin started