Category Archives: ESP32 NodeMCU

ESP32 NodeMCU Module – Net

Functions

  • Constants – Constants to be used in other functions: net.
  • net.createConnection()  – Creates a client.
  • net.createServer()  – Creates a server.
  • net.createUDPSocket()  – Creates an UDP socket.
  • net.multicastJoin()  – Join multicast group.
  • net.multicastLeave()  – Leave multicast group.
  • net.server:close()  – Closes the server.
  • net.server:listen()  – Listen on port from IP address.
  • net.server:getaddr()  – Returns server local address/port.
  • net.socket:close()  – Closes socket.
  • net.socket:connect()  – Connect to a remote server.
  • 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.
  • 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.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.

Ex : Create a server Connection

  • Creates a server using function for 30 seconds timeout net.createServer([type[, timeout]])

Ex : Receive function

Ex : Web server function


TCP Server Connection(Client)

  • Connect the WiFi Station
  • Once got IP address then run Server_Run()  Function
  • Create a connection
  • Connect the server
  • Send the Data “ArunEwolrd IOT Project” to Server

 

 


Next :

Previous :


 

ESP32 NodeMCU Module – I2C

Pr-Request to Lean

 


ESP32 NodeMCU Module I2C Functions

  • i2c.address()  – Send (SW) or queue (HWx) I²C address and read/write mode for the next transfer.
  • i2c.read()  – Read (SW) or queue (HWx) data for variable number of bytes
  • i2c.setup()  – Initialize the I²C interface for master mode.
  • i2c.start()  – Send (SW) or queue (HWx) an I²C start condition.
  • i2c.stop()  – Send (SW) or queue (HWx) an I²C stop condition.
  • i2c.transfer()  – Starts a transfer for the specified hardware module.
  • i2c.write()  – Write (SW) or queue (HWx) data to I²C bus.
  • i2c.slave.on()  – Registers or unregisters an event callback handler.
  • i2c.slave.setup()  – Initialize the I²C interface for slave mode.
  • i2c.slave.send()  – Writes send data for the master into the transmit buffer.

 


ESP32 I2C Scanner Code

  • In this code used to can the i2c Devices
  • Used Software i2c and GPIO-23 as SDA and GPIO-22 as SCL of I2C Device
  • Connected DS3231 Device and check i2c address of DS3231

Code

Results

 


See Also

 


Next :

Previous :


 

if you have any queries call us +918300026060 or WhatsApp Dismiss

0

Your Cart

%d bloggers like this: