layout | title | excerpt | categories | comments |
---|---|---|---|---|
post |
NodeMcu Set Up on Mac OS |
How to start a project with NodeMcu in Mac Environment |
Lua NodeMcu Mac |
true |
pip install esptool
Get a custom build from here
The driver can be downloaded from this link
Once the driver is properly installed, you can connect the board to a USB port
on mac. Then find out the serial port name by running cmd ls -l /dev/tty.*
The connected port showed up as /dev/tty.wchusbserial1420
Use esptool.py to flash the binary onto the board.
# Command is written in this format
esptool.py --port <USB SERIAL PORT NAME> write_flash -fm dio -fs 32m 0x00000 <image_name>.bin
# For example
esptool.py --port /dev/tty.wchusbserial1420 write_flash -fm dio -fs 32m 0x00000 nodemcu-master-7-modules-2016-06-03-01-44-33-float.bin
screen /dev/tty.wchusbserial1420 9600
You should see the NodeMcu's lua prompt upon successful connection. Adafruit has a good tutorial for setting up the connection with local wifi.
To scan the local wifi networks:
-- print ap list
function listap(t)
for k,v in pairs(t) do
print(k.." : "..v)
end
end
wifi.sta.getap(listap)
To establish connection:
wifi.sta.config("accesspointname","yourpassword")
wifi.sta.connect()
tmr.delay(1000000) -- wait 1,000,000 us = 1 second
print(wifi.sta.status())
print(wifi.sta.getip())
exit screen by typing ctrl + a
then ctrl + /
ESPlorer is the first IDE listed on NodeMcu's official document. Once
you downloaded the binary, you can start the IDE by first cd into
the ESPlorer folder, then run java -jar "ESPlorer.jar"
After playing around with Lua commands for 30min or so, I realized that before I can implement real IoT applications, I have to getting through a steep learning curve.