Node package for Respeaker 4-mic hat?

Hi I tested the LED with nodejs successfully. the LED uses the SPI and audio uses the I2S. we have to enable te spi first by following https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp.


  1. install dependiences



    sudo apt-get update

    sudo apt-get dist-upgrade

    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

    node -v

    npm install apa102-spi


  2. please create a led.js file with below code.



    var Apa102spi = require(‘apa102-spi’)



    // Apa102spi(number of leds, clock divider)

    var LedDriver = new Apa102spi(9, 100)



    // setLedColor(n, brightness 0-31, red 0-255, green 0-255, blue 0-255) , n=0 led1; n=1, led2; n=2, led3;

    LedDriver.setLedColor(0, 1, 255, 0, 0)



    // send data to led string

    LedDriver.sendLeds()




  3. run node led.js and see the led turned on.



    For the I2S, i do not test it. thanks.



    Seeed techsupport team

    Bill