neonious / lowjs

A port of Node.JS with far lower system requirements. Community version for POSIX systems such as Linux, uClinux or Mac OS X.
http://www.lowjs.org/
Other
1.27k stars 72 forks source link

spi uses the device to disconnect #139

Closed yueduz closed 3 years ago

yueduz commented 3 years ago

Hi! I want to use the spi device, I only need to receive data from the slave, and the host does not need to send data.

I use the following code:

            var s = new spi.SPI({ pinSCLK: 18, pinMISO: 19, pinMOSI: 23 });
            s.transfer(Buffer.from([0x00, 0x00]), (err, data) => {
                console.log(err);
                console.log(data);
            });

Always get the following result:

$ lowsync sync
Fetching file system listings...
Reminder: No password set! Please set one via the lowsync settings set web.password="..." command. Continuing...
Synchronization complete |██████████████████████████████| 100%
PC => MC: +File index.js
? Would you like to show the output of the microcontroller? (Use the --monitor command line option to remove this prompt and enable/disable showing of the output after sync.) Yes
Restarting program...
Starting monitor...
--- User program's output: ---
*** The connection has been lost. We will retry connecting to the microcontroller. In the meantime, please check your connection ***
*** The connection to the microcontroller has been re-established ***
*** The connection has been lost. We will retry connecting to the microcontroller. In the meantime, please check your connection ***
*** The connection to the microcontroller has been re-established ***

thank you!