TiLDA MK4/sim800
Overview
Calling
Call
sim800.call(number)
number = Number to call. This can be an integer but you will need ti use a string if your number has a "0" prefix
Answer Call
sim800.answer()
End/Reject Call
sim800.hangup()
Redial
sim800.redial()
Incoming Call Number
sim800.latestnumber()
Returns the number of the current caller if ringing. Returns the number of the last caller if not ringing.
Ringing
sim800.isringing()
Returns True if ringing.
The sim800.getstatus() also returns 2 when ringing and machine.Pin(machine.Pin.GPIO_SIM_RI, machine.Pin.IN).value() will show the start of the hardware ringer indicator pin. You an also user a callback (documented below) with the call name of "RING".
Play DTMF
sim800.dtmf(number)
Plays DTMF tones on an active call.
number: The number of the tone to play. This can a string of numbers that are played in sequence. Using "," will pause for one second. (int or str)
SMS
List SMS Messages
sim800.listsms([stat])
List available SMS messages.
stat:
- 0 = received unread messages (default)
- 1 = Received read messages
- 2 = Stored unsent messages
- 3 = Stored sent messages
- 4 = All message
File System
The SIM800 module has around 90KB of file storage. This can be used to store files to send to or receive from and paired Bluetooth device as well as for audio recordings.
Free Space
sim800.fsfree()
Returns the number of bytes available in the file system.
List Directory
sim800.fsls([directory])
directory: The directory on the file system relative to root to list. Directories end with a backslash. The root directory is returned if no parameter is given.
A list of file names is returned. Directories end with a "\". Don't forget to escape this as "\\" in your code.
File Size
sim800.fssize(filename)
filename: The directory and filename of the file.
The size of the file in bytes. A size of -1 is returned if the file does not exist.
Create Directory
sim800.fsmkdir(directory)
Creates a directory.
directory: The name of the directory to create.
Remove Directory
Removes a directory.
sim800.fsrmdir(directory)
directory: The name of the directory to delete.
Create a file
sim800.fscreate(filename)
Creates an empty file.
filename: The filename of the file (including directory) to create.
Read From File
sim800.fsread(filename)
Returns the contents of the file.
filename: The filename of the file (including directory) to read.
Note that this can be slow. You may want to use sim800.uartspeed(460800) to speed things up but you are advised to call sim800.uartspeed(0) after to switch back to automatic.
Write To File
sim800.fswrite(filename, data, [truncate])
filename: The filename of the file (including directory) to read. data: The data to write to the file truncate: If True the original file emptied first. If False data is appended to the end of the file. Defaults to False.
Note that this can be slow. You may want to use sim800.uartspeed(460800) to speed things up but you are advised to call sim800.uartspeed(0) after to switch back to automatic.
Delete File
sim800.fsrm(filename)
filename: The filename of the file to delete.
Rename File
sim800.fsmv(from, to)
Rename a file.
from: The old filename. To: The new filename.
Bluetooth
sim800.