1

I've been trying to send commands to an ESP8266 using the terminal on OSX. I've been able to open the nodemcu interface using screen and send commands successfully, but when I try and send commands via echo (turning the on board LED on):

echo "gpio.mode(3,gpio.OUTPUT) gpio.write(3,gpio.LOW)" > /dev/cu.SLAB_USBtoUART

the command executes but nothing happens. However if I have a second terminal running:

cat /dev/cu.SLAB_USBtoUART

to read the console the echo command executes and the light turns on.

I've been able to run the command on ubuntu (changing the /dev/ path) and it worked without the second terminal. I've found using screen that any command executed via echo without the cat terminal being open just sends the first letter. I've also found the same problem using printf instead of echo.

JeremyP
  • 84,577
  • 15
  • 123
  • 161
J Field
  • 21
  • 1
  • Just some thoughts: 1) are the device files the same type on both OSX and Ubuntu (character or block?), 2) is there a difference in the default configuration of the serial port (check with "setserial -a /dev/xxx") – Wayne Vosberg Oct 11 '17 at 16:40
  • OSX doesn't have setserial (not on homebrew either), would stty be helpful instead? It's a character device on OSX. I don't have access to a linux machine today, but I've looked at mingw in windows. That also uses a character device, and can echo commands without any problems (so I'd guess linux uses a character device as well). – J Field Oct 12 '17 at 07:56
  • Yes, comparing stty output may provide a clue (stty -a -F /dev/xxx). – Wayne Vosberg Oct 12 '17 at 11:27

0 Answers0