PYCO-WIFI
AI
-
mp_obj_t AI_readOnDemand()
Read AI on demand.
- Return values:
value_list – List of voltages in [V] of all 8 channels.
List – Analog voltage with 8 channels.
-
mp_obj_t AI_readNsample(mp_obj_t points, mp_obj_t delay)
Read AI N-samples.
- Parameters:
points – The number of receiving sample points.
delay – Time in seconds to wait for the indicated amount of data to arrive.
- Return values:
2D_list – The list of list of AI data in volt.
-
mp_obj_t AI_start(mp_obj_t sampling_rate, mp_obj_t points)
Start AI streaming. Before executing
AI_readNsample
, it should callAI_start
.- Parameters:
sampling_rate – Sampling rate in Hz.
points – Number of sample points.
- Return values:
int – WPC error code.
-
mp_obj_t AI_stop()
Stop AI streaming.
- Return values:
int – WPC error code.
AO
-
mp_obj_t AO_writeOneChannel(mp_obj_t channel, mp_obj_t value)
Write to a single AO channel.
- Parameters:
ch – Channel number (0 to 7).
value – Voltage in [V] (-10 to 10).
- Return values:
status – WPC error code.
-
mp_obj_t AO_writeAllChannels(mp_obj_t value_list)
Write to all AO channels.
- Parameters:
value_list –
List of voltages in [V] (-10 to 10) of all 8 channels.
The length should be 8.
- Return values:
status – WPC error code.
DIO
-
mp_obj_t DI_readAllChannels()
Read from the whole DI port.
- Return values:
value_list – List of pin states (0 or 1) of all 8 channels.
-
mp_obj_t DO_writeAllChannels(mp_obj_t value_list)
Write to the whole DO port.
- Parameters:
value_list – List of pin states (0 or 1) of all 8 channels.
- Return values:
status – WPC error code.
BATTERY
-
mp_obj_t Batt_read()
Get volatge status of battery.
- Return values:
float – Battery level in volt.
LED
-
mp_obj_t LED_reset()
Reset LED.
- Return values:
int – WPC error code.
-
mp_obj_t LED_setBlue()
Set LED to blue.
- Return values:
int – WPC error code.
-
mp_obj_t LED_setGreen()
Set LED to green.
- Return values:
int – WPC error code.
-
mp_obj_t LED_setRed()
Set LED to red.
- Return values:
int – WPC error code.
OLED
-
mp_obj_t OLED_erase()
Erase message on the screen.
- Return values:
int – WPC error code.
-
mp_obj_t OLED_writeLine(mp_obj_t write_data, mp_obj_t write_line)
Write message on the screen.
- Parameters:
write_data – what you want to write on the screen.
write_line – The location line on the screen.
- Return values:
int – WPC error code.
-
mp_obj_t OLED_writeXY(mp_obj_t x_position, mp_obj_t y_position, mp_obj_t write_data)
Write message on the screen.
- Parameters:
x_position – X coordinate.
y_position – Y coordinate.
write_data – what you want to write on the screen.
- Return values:
int – WPC error code.
SYSTEM
-
mp_obj_t Sys_APMode()
Go to AP mode.
- Return values:
int – WPC error code.
-
mp_obj_t Sys_disableMain()
Disable executing main.py when it reboot.
- Return values:
int – WPC error code.
-
mp_obj_t Sys_enableMain()
Enable executing main.py when it reboot.
- Return values:
int – WPC error code.
-
mp_obj_t Sys_getMAC()
Get MAC address.
- Return values:
value_list – A list with length of 6 representing MAC address.
-
mp_obj_t Sys_reboot()
Reboot device.
- Return values:
int – WPC error code.
-
mp_obj_t Sys_getDriverVersion()
Get stand-alone python version.
- Return values:
String – Version name.
-
mp_obj_t Sys_getDriverName()
Get stand-alone python driver name.
- Return values:
String – Driver name.
-
mp_obj_t Sys_getDAQHeapSize()
Get stand-alone heap size.
- Return values:
int – Heap size.
-
mp_obj_t Sys_convertF32To4U8(mp_obj_t value)
Convert float to 4U8.
- Return values:
List – The list of U8.
-
mp_obj_t Sys_setWifiSSID(mp_obj_t value)
Set Wifi SSID.
- Parameters:
value – SSID.
- Return values:
int – WPC error code.
-
mp_obj_t Sys_setWifiPassword(mp_obj_t value)
Set Wifi password.
- Parameters:
value – password.
- Return values:
int – WPC error code.
-
mp_obj_t Sys_setIP(mp_obj_t value)
Set IP.
- Parameters:
value – IP.
- Return values:
int – WPC error code.
-
mp_obj_t Sys_getSerialNumber()
Get stand-alone python driver serial number.
- Return values:
String – Serial number.
-
mp_obj_t Sys_getIP()
Get stand-alone python driver IP.
- Return values:
value_list – A list with length of 4 representing IP address.
-
mp_obj_t Sys_getSubmask()
Get stand-alone python driver submask.
- Return values:
value_list – A list with length of 4 representing submask.
-
mp_obj_t Sys_getGateway()
Get stand-alone python driver gateway.
- Return values:
value_list – A list with length of 4 representing gateway.
-
mp_obj_t Sys_readFuncButton()
Read function button status.
- Return values:
Status. –
TCP CLIENT
-
mp_obj_t TCPClient_open(mp_obj_t host_ip, mp_obj_t port)
Open a client which can connect to a specified address and port.
- Parameters:
host – Host IP address or host name.
port – The port that the client will connect to.
- Return values:
int – WPC error code.
-
mp_obj_t TCPClient_close()
Close TCP client.
- Return values:
int – WPC error code.
-
mp_obj_t TCPClient_writeString(mp_obj_t write_data)
Write string to the server that the client is connected to.
- Parameters:
value – Value to write.
- Return values:
int – The number of bytes written.
-
mp_obj_t TCPClient_read(mp_obj_t read_len)
Read the bytes received from the server that the client is connected to.
- Parameters:
size – Reads available bytes up to size from the server.
- Return values:
List – The list of bytes read from buffer.
-
mp_obj_t TCPClient_writeU8List(mp_obj_t u8_list)
Write U8 list to the server that the client is connected to.
- Parameters:
u8_list – The U8 list to write.
- Return values:
int – The number of bytes written.
MODBUS MASTER
-
mp_obj_t ModbusMaster_open(mp_obj_t host, mp_obj_t slave)
Open the Modbus master.
- Parameters:
host – Host IP address or host name.
slave – Modbus slave ID.
- Return values:
int – WPC error code.
-
mp_obj_t ModbusMaster_close()
Close the Modbus master.
- Return values:
int – WPC error code.
-
mp_obj_t ModbusMaster_readCoils(mp_obj_t address, mp_obj_t count)
Read coils.
- Parameters:
address – The coil starting address.
count – The total number of coils requested.
- Return values:
List – The list of bool or WPC error code if fail.
-
mp_obj_t ModbusMaster_readDiscreteInputs(mp_obj_t address, mp_obj_t count)
Read discrete inputs.
- Parameters:
address – The discrete input starting address.
count – The total number of coils requested.
- Return values:
List – The list of bool or WPC error code if fail.
-
mp_obj_t ModbusMaster_readHoldingRegister(mp_obj_t address, mp_obj_t count)
Read holding registers.
- Parameters:
address – The holding register starting address.
count – The total number of registers requested.
- Return values:
List – The list of registers or WPC error code if fail.
-
mp_obj_t ModbusMaster_readInputRegister(mp_obj_t address, mp_obj_t count)
Read input registers.
- Parameters:
address – The input register starting address.
count – The total number of registers requested.
- Return values:
List – The list of registers or WPC error code if fail.
-
mp_obj_t ModbusMaster_writeCoil(mp_obj_t address, mp_obj_t value)
Update a single coil.
- Parameters:
address – The output address.
value – The status to write.
- Return values:
int – WPC error code.
-
mp_obj_t ModbusMaster_writeRegister(mp_obj_t address, mp_obj_t value)
Update a single register.
- Parameters:
address – The register address.
value – The value to write.
- Return values:
int – WPC error code.
-
mp_obj_t ModbusMaster_writeMultiCoils(mp_obj_t address, mp_obj_t value_list)
Update multiple coils.
- Parameters:
address – The address of the first coil.
value_list – List of bit value.
- Return values:
int – WPC error code.
-
mp_obj_t ModbusMaster_writeMultiRegisters(mp_obj_t address, mp_obj_t value_list)
Update multiple registers.
- Parameters:
address – The starting address.
value_list – List of bytes to write.
- Return values:
int – WPC error code.
MODBUS SLAVE
-
mp_obj_t ModbusSlave_inputRegisterWriteFloat(mp_obj_t reg, mp_obj_t float_data)
Write the float value of the server’s Input Register for the specified address and value.
- Parameters:
address – The range of input registers is from 41000 to 41499.
value – Input register value to write.
- Return values:
int – WPC error code.
-
mp_obj_t ModbusSlave_inputRegisterWriteInt(mp_obj_t reg, mp_obj_t int_data)
Write the int value of the server’s Input Register for the specified address and value.
- Parameters:
address – The range of input registers is from 41000 to 41499.
value – Input register value to write.
- Return values:
int – WPC error code.
-
mp_obj_t ModbusSlave_open()
Open the Modbus slave.
- Return values:
int – WPC error code.
-
mp_obj_t ModbusSlave_close()
Close the Modbus slave.
- Return values:
int – WPC error code.
TEMPERATURE
-
mp_obj_t Temperature_read()
Get temperature from thermal sensor.
- Return values:
float – Temperature in Celsius.