Snap4Arduino icon indicating copy to clipboard operation
Snap4Arduino copied to clipboard

getting esp8266 NodeMCU to work over USB?

Open drzraf opened this issue 1 year ago • 1 comments

I've seen comments about snap4arduino working over wifi using StandardFirmataWifi for esp8266 NodeMCU but I've a simpler use-case I can't still fulfill: I would like to make it work over USB, I used StandardFirmata (actually StandardFirmataESP8266Serial) and can blink the LED using pyfirmata:

board = Arduino('/dev/ttyUSB0')
board.digital[2].write(HIGH)

but snap4arduino connect button responds that it Could not talk to Arduino in port /dev/ttyUSB0 Check if firmata is loaded. Screenshot from 2024-06-09 02-30-04

  1. Is it expected?
  2. How do you suggest to pinpoint the underlying issue from the corresponding command-line (or any built-in debugging feature from snap4arduino)?

drzraf avatar Jun 09 '24 05:06 drzraf

Hi Raphaël ( @drzraf ) I guess everybody is using FirmataWifi with ESP8266... but you can play over serial USB. Three tips:

  • I have to add one line to StandardFirmata code, because pins 1 and 3 are the TX and RX pins so they have to be ignored or they will cause conflicts when using the USB serial connection The line is if (i == 1 || i == 3) continue; and it have to be added after
  for (byte i = 0; i < TOTAL_PINS; i++) {
    // pins with analog capability default to analog input
    // otherwise, pins default to digital output
  • And you know, when you are connecting from Snap4Arduino (while it is trying to connect...) you have to press 'reset' button on your NodeMCU
  • And I see (testing now for answering your question) that the disconnect action is not well configured for this board. Then, you have to re-plug your USB after a disconnection... to be able to reconnect.

Joan

jguille2 avatar Jun 14 '24 22:06 jguille2