TiLDA MK4/sim800: Difference between revisions
m (Formatting) |
(Added file system calls) |
||
Line 9: | Line 9: | ||
<code>sim800.call(number)</code> | <code>sim800.call(number)</code> | ||
number = Number to call | 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 | === Answer Call === | ||
<code>sim800.answer()</code> | <code>sim800.answer()</code> | ||
Line 43: | Line 43: | ||
Plays DTMF tones on an active call. | Plays DTMF tones on an active call. | ||
number | 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 == | == SMS == | ||
Line 49: | Line 49: | ||
=== List SMS Messages === | === List SMS Messages === | ||
<code>sim800.listsms(stat)</code> | <code>sim800.listsms([stat])</code> | ||
List available SMS messages. | List available SMS messages. | ||
stat | stat: | ||
: 0 = received unread messages (default) | : 0 = received unread messages (default) | ||
: 1 = Received read messages | : 1 = Received read messages | ||
Line 61: | Line 61: | ||
== File System == | == 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 === | |||
<code>sim800.fsfree()</code> | |||
Returns the number of bytes available in the file system. | |||
=== List Directory === | |||
<code>sim800.fsls([directory])</code> | |||
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 === | |||
<code>sim800.fssize(filename)</code> | |||
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 === | |||
<code>sim800.fsmkdir(directory)</code> | |||
Creates a directory. | |||
directory: The name of the directory to create. | |||
=== Remove Directory === | |||
Removes a directory. | |||
<code>sim800.fsrmdir(directory)</code> | |||
directory: The name of the directory to delete. | |||
=== Create a file === | |||
<code>sim800.fscreate(filename)</code> | |||
Creates an empty file. | |||
filename: The filename of the file (including directory) to create. | |||
=== Read From File === | |||
<code>sim800.fsread(filename)</code> | |||
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 === | |||
<code>sim800.fswrite(filename, data, [truncate])</code> | |||
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 === | |||
<code>sim800.fsrm(filename)</code> | |||
filename: The filename of the file to delete. | |||
=== Rename File === | |||
<code>sim800.fsmv(from, to)</code> | |||
Rename a file. | |||
from: The old filename. | |||
To: The new filename. | |||
== Bluetooth == | == Bluetooth == | ||
=== === | |||
<code>sim800.</code> | |||
== Network and Status == | |||
== Custom Cals == | |||
== Callbacks == | == Callbacks == |
Revision as of 15:24, 29 August 2018
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.