Tarjeta SD#
cargar archivo()#
The loadfile(filename, buffer, len)
method loads the named file. If the optional bytearray is None, then an empty file is created.
Parámetros |
Descripción |
---|---|
Nombre del archivo |
El nombre del archivo a leer. |
buffer |
Un puntero a un lugar en la memoria donde se almacenarán los datos del archivo. |
lente |
La longitud del búfer en bytes. |
Devuelve: Un bytearray con los datos del archivo.
se inserta()#
The is_inserted()
method returns the status of the SD Card.
Returns: True
if an SD card is inserted into the brain. False
if it is not.
tamaño()#
The size(filename)
method returns the size in bytes of the named file.
Parámetros |
Descripción |
---|---|
Nombre del archivo |
El nombre del archivo a comprobar. |
Devuelve: El tamaño del archivo en bytes.
guardar archivo()#
The savefile(filename, buffer, len)
method saves a bytearray into a named file. If the optional bytearray is None, then an empty file is created.
Parámetros |
Descripción |
---|---|
Nombre del archivo |
El nombre del archivo a escribir. |
buffer |
Un puntero a un lugar en la memoria donde se almacenarán los datos del archivo. |
lente |
La longitud del búfer en bytes. |
Devuelve: El número de bytes escritos.
// Write the bytearray into a file.
Brain.SDcard.savefile('MyTextFile.txt', bytearray("Hello "))
archivo adjunto()#
The appendfile(filename, buffer, len)
method appends a bytearray into a named file. Append is used to add more data to an existing file.
Parámetros |
Descripción |
---|---|
Nombre del archivo |
El nombre del archivo a escribir. |
buffer |
Un puntero a un lugar en la memoria donde se almacenarán los datos del archivo. |
lente |
La longitud del búfer en bytes. |
Devuelve: El número de bytes escritos.
# Append the bytearray into a file.
Brain.sdcard.appendfile('MyTextFile.txt', bytearray("World "))
tamaño()#
The size(filename)
method returns the size in bytes of the named file.
Parámetros |
Descripción |
---|---|
Nombre del archivo |
El nombre del archivo a comprobar. |
Devuelve: El tamaño del archivo en bytes.
existe()#
The exists(filename)
method checks to see if the named file exists on the sd card.
Parámetros |
Descripción |
---|---|
Nombre del archivo |
El nombre del archivo a comprobar. |
Returns: true
if file exists. false
if it does not exist.