gpio
and i2c
modules are more complete and tested.luarocks
ffi
support (currently used)struct
information) NOTE: currently luajit
is disregarded, but lua5.1
is usedadc.force_init_mode()
Checks and if necessary reconfigures the ADC mode setting in the ESP init data block.adc.read()
Samples the ADC.adc.readvdd33()
Reads the system voltage.cron.schedule()
Creates a new schedule entry.cron.reset()
Removes all scheduled entries.cron.entry:handler()
Sets a new handler for entry.cron.entry:schedule()
Sets a new schedule mask.cron.entry:unschedule()
Disables schedule.io
module, vastly untestedfile.chdir()
Change current directory (and drive).file.exists()
Determines whether the specified file exists.file.format()
Format the file system.file.fscfg()
Returns the flash address and physical size of the file system area, in bytes.file.fsinfo()
Return size information for the file system.file.list()
Lists all files in the file system.file.mount()
Mounts a FatFs volume on SD card.file.on()
Registers callback functions.file.open()
Opens a file for access, potentially creating it (for write modes).file.remove()
Remove a file from the file system.file.rename()
Renames a file.file.stat()
Get attribtues of a file or directory in a table.file.close(), file.obj:close()
Closes the open file, if any.file.flush(), file.obj:flush()
Flushes any pending writes to the file system, ensuring no data is lost on a restart.file.read(), file.obj:read()
Read content from the open file.file.readline(), file.obj:readline()
Read the next line from the open file.file.seek(), file.obj:seek()
Sets and gets the file position, measured from the beginning of the file, to the position given by offset plus a base specified by the string whence.file.write(), file.obj:write()
Write a string to the open file.file.writeline(), file.obj:writeline()
Write a string to the open file and append 'n' at the end.gpio.mode()
Initialize pin to GPIO mode, set the pin in/out direction, and optional internal weak pull-up.gpio.read()
Read digital GPIO pin value.gpio.serout()
Serialize output based on a sequence of delay-times in µs.gpio.trig()
Establish or clear a callback function to run on interrupt for a pin.gpio.write()
Set digital GPIO pin value.net
module to work)http.delete()
Executes a HTTP DELETE request.http.get()
Executes a HTTP GET request.http.post()
Executes a HTTP POST request.http.put()
Executes a HTTP PUT request.http.request()
Execute a custom HTTP request for any HTTP method.net
module)net.createConnection()
Creates a client.net.socket:close()
Closes socket.net.socket:getpeer()
Retrieve port and ip of remote peer.net.socket:getaddr()
Retrieve local port and ip of socket.net.socket:hold()
Throttle data reception by placing a request to block the TCP receive function.net.socket:on()
Register callback functions for specific events.connection
receive
close
sent
net.socket:send()
Sends data to remote peer.net.socket:connect()
Connect to a remote server.net.socket:ttl()
Changes or retrieves Time-To-Live value on socket.net.socket:unhold()
Unblock TCP receiving data by revocation of a preceding hold().net.createServer()
Creates a server.net.server:close()
Closes the server.net.server:getaddr()
Returns server local address/port.net.server:listen()
Listen on port from IP address.net.socket:dns()
Provides DNS resolution for a hostname.net.socket:getpeer()
Retrieve port and ip of remote peer.net.socket:getaddr()
Retrieve local port and ip of socket.net.socket:hold()
Throttle data reception by placing a request to block the TCP receive function.net.socket:on()
Register callback functions for specific events.connection
receive
sent
net.socket:send()
Sends data to remote peer.net.socket:ttl()
Changes or retrieves Time-To-Live value on socket.net.socket:unhold()
Unblock TCP receiving data by revocation of a preceding hold().net.createUDPSocket()
Creates an UDP socket.net.multicastJoin()
Join multicast group.net.multicastLeave()
Leave multicast group.net.udpsocket:close()
Closes UDP socket.net.udpsocket:listen()
Listen on port from IP address.net.udpsocket:on()
Register callback functions for specific events.net.udpsocket:send()
Sends data to specific remote peer.net.udpsocket:dns()
Provides DNS resolution for a hostname.net.udpsocket:getaddr()
Retrieve local port and ip of socket.net.udpsocket:ttl()
Changes or retrieves Time-To-Live value on socket.net.dns.getdnsserver()
Gets the IP address of the DNS server used to resolve hostnames.net.dns.resolve()
Resolve a hostname to an IP address.net.dns.setdnsserver()
Sets the IP of the DNS server used to resolve hostnames.node.bootreason()
Returns the boot reason and extended reset info.node.chipid()
Returns the ESP chip ID.node.compile()
Compiles a Lua text file into Lua bytecode, and saves it as .node.dsleep()
Enters deep sleep mode, wakes up when timed out.node.flashid()
Returns the flash chip ID.node.flashsize()
Returns the flash chip size in bytes.node.heap()
Returns the current available heap size in bytes.node.info()
Returns NodeMCU version (major,minor,dev), chipid, flashid, flash size, flash mode, flash speed, architecture (new: 'esp8266', 'esp32', or 'linux')node.input()
Submits a string to the Lua interpreter.node.output()
Redirects the Lua interpreter output to a callback function.node.restart()
Restarts the chip/device, Hint: nodemcu
must be run as root
(e.g. via sudo nodemcu
)node.restore()
node.setcpufreq()
Change the working CPU Frequency [MHz], loose setting (e.g. choosing next possible valid frequency out of a table)node.sleep()
Put NodeMCU in light sleep mode to reduce current consumption.node.stripdebug()
Controls the amount of debug information kept during node.node.osprint()
Controls whether the debugging output from the SDK is printed.node.random()
This behaves like math.node.egc.setmode()
Sets the Emergency Garbage Collector mode.node.task.post()
Enable a Lua callback or task to post another task request.rtctime.dsleep()
Puts the device into deep sleep mode, like node.rtctime.dsleep_aligned()
For applications where it is necessary to take samples with high regularity, this function is useful.rtctime.epoch2cal()
Converts a Unix timestamp to calendar format.rtctime.get()
Returns the current time.rtctime.set()
Sets the rtctime to a given timestamp in the Unix epoch (i.sjson.encoder()
This creates an encoder object that can convert a LUA object into a JSON encoded string.sjson.encoder:read()
This gets a chunk of JSON encoded data.sjson.encode()
Encode a Lua table to a JSON string.sjson.decoder()
This makes a decoder object that can parse a JSON encoded string into a lua object.sjson.decoder:write()
This provides more data to be parsed into the lua object.sjson.decoder:result()
This gets the decoded lua object, or raises an error if the decode is not yet complete.sjson.decode()
Decode a JSON string to a Lua table.lunajson
(currently used)sntp.sync()
Attempts to obtain time synchronization.sntp.setoffset()
Sets the offset between the rtc clock and the NTP time.sntp.getoffset()
Gets the offset between the rtc clock and the NTP time.struct.pack()
struct.unpack()
luanode
is used as Lua framework:tmr.now()
Returns the system counter, which counts in microseconds.tmr.time()
Returns the system uptime, in seconds (integer)tmr.uptime()
(new) Returns the system uptime in seconds with microsecond precision (float)tmr.create()
Creates a dynamic timer object.tmr:alarm()
This is a convenience function combining tmr.tmr:interval()
Changes a registered timer's expiry interval.tmr:register()
Configures a timer and registers the callback function to call on expiry.tmr:resume()
Resume an individual timer.tmr:start()
Starts or restarts a previously configured timer.tmr:state()
Checks the state of a timer.tmr:stop()
Stops a running timer, but does not unregister it.tmr:suspend()
Suspend an armed timer.tmr:unregister()
Stops the timer (if running) and unregisters the associated callback.tmr.resume_all()
Resume all timers.tmr.suspend_all()
Suspend all currently armed timers.tmr.softwd()
Provides a simple software watchdog, which needs to be re-armed or disabled before it expires, or the system will be restarted.tmr.wdclr()
Feed the system watchdog.wifi.getchannel()
Gets the current WiFi channel.wifi.getmode()
Gets WiFi operation mode.wifi.mode()
Configures the WiFi mode to use.wifi.start()
Starts the WiFi interface(s).wifi.stop()
Shuts down the WiFi interface(s).wifi.sta.config()
Sets the WiFi station configuration.wifi.sta.connect()
Connects to the configured AP in station mode.wifi.sta.disconnect()
Disconnects from AP in station mode.wifi.sta.on()
Registers callbacks for WiFi station status events.wifi.sta.getmac()
Gets MAC address in station mode.wifi.sta.scan()
Scan for available networks.wifi.ap.config()
Configures the AP.wifi.ap.on()
Registers callbacks for WiFi AP events.wifi.ap.getmac()
Gets MAC address in access point mode.wifi.sta.gethostname()
wifi.sta.sethostname()
wifi.sta.status()
wifi.sta.getmac()
hidd --search
.hciconfig scan
I get:hcitool scan
isn't finding anything since my speakers are connected and every time I run the command the sound from the speakers breaks for a couple of seconds.sudo apt-get install bluez-tools
bt-device -l
bt-audio -c 01:02:03:04:05:06
bt-audio
feature is being reimplemented for newer versions.sudo apt-get install bluez-tools
, because I did use it at some point.hcitool scan
,I ran bluez-simple-agent hci0 X
where X is the mac address of the device I was adding. This created the connection to the device.hciconfig scan
and it seems to have automatically started the connection. hcitool
and I'd like to point out something that I noted which solves your issue of doing a scan and the process 'just dying'. The thing is the scan only works if the devices are unpaired. In your case, you say you can see the speakers are connected on the GUI which means they've already been paired..hence the scan returns nothing.bluetoothctl
.bt-device -c 00:02:5B:01:3C:3B; pacmd set-default-sink bluez_sink.00_02_5B_01_3C_3B.a2dp_sink
bt-device -l
to get the MAC address.)pacmd list-sinks | awk '/index:/ {print $0}; /name:/ {print $0}; /device.description/ {print $0}'
to get the correct name.) hciconfig
.sudo hcitool lescan
did the job for me - maybe it can still help you!