You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each call to this function with positional arguments will generate a new
20
-
header entry into the log file.
19
+
Ideally this function should be called a single time, before any data is
20
+
logged, to configure the data table header once.
21
21
22
-
If the program starts and a log file already exists it will compare the
23
-
labels set up by this function call to the last headers declared in the
24
-
file. If the headers are different it will add a new header entry at the
25
-
end of the file.
22
+
If a log file already exists when the program starts, or if this function
23
+
is called multiple times, it will check the labels already defined in the
24
+
log file. If this function call contains any new labels not already
25
+
present, it will generate a new header row with the additional columns.
26
26
27
-
:param *args: Un argumento posicional para cada cabecera de registro.
28
-
:param timestamp: (marca de tiempo) La unidad de marca temporal que se añadirá automáticamente como la primera columna en cada fila.
29
-
Establecer este argumento a ``None`` desactiva la marca temporal. Se le pueden pasar los valores ``log.MILLISECONDS``, ``log.SECONDS``, ``log.MINUTES``, ``log.HOURS`` o ``log.DAYS`` definidos en este módulo. Un valor no válido lanzará una excepción."""
27
+
By default the first column contains a timestamp for each row. The time
28
+
unit can be selected via the timestamp argument.
29
+
30
+
:param *labels: Any number of positional arguments, each corresponding to an entry in the log header.
31
+
:param timestamp: (marca de tiempo) Select the timestamp unit that will be automatically added as the first column in every row. Timestamp values can be one of ``log.MILLISECONDS``, ``log.SECONDS``, ``log.MINUTES``, ``log.HOURS``, ``log.DAYS`` or ``None`` to disable the timestamp. The default value is ``log.SECONDS``."""
Keyword arguments not already specified via the ``set_labels`` function,
59
-
or by a previous call to this function, will trigger a new header entry
60
-
to be added to the log with the extra label.
60
+
New labels not previously specified via the set_labels function, or by a
61
+
previous call to this function, will trigger a new header entry to be added
62
+
to the log with the extra labels.
61
63
62
-
Labels previously specified and not present in this function call will be
63
-
skipped with an empty value in the log row."""
64
+
Labels previously specified and not present in a call to this function will
65
+
be skipped with an empty value in the log row."""
64
66
...
65
67
66
68
defdelete(full=False):
67
69
"""Elimina el contenido del registro, incluyendo las cabeceras. (eliminar)
68
70
69
71
Example: ``log.delete()``
70
72
71
-
To add the log headers the ``set_labels`` function has to be called again
72
-
after this.
73
+
To add the log headers again the ``set_labels`` function should to be called after this function.
74
+
75
+
There are two erase modes; “full” completely removes the data from the physical storage,
76
+
and “fast” invalidates the data without removing it.
73
77
74
-
:param full: (completo) Selecciona un formato de borrado "completo" que elimina los datos del almacenamiento flash.
75
-
Si se pone a ``False`` (falso), usa un método "rápido" que invalida los datos en lugar de realizar un borrado completo más lento."""
78
+
:param full: (completo) ``True`` selects a “full” erase and ``False`` selects the “fast” erase method."""
76
79
...
77
80
78
81
defset_mirroring(serial: bool):
79
-
"""Replica la actividad del registro de datos en la salida serie. (configurar replicación)
82
+
"""Configure mirroring of the data logging activity to the serial output. (configurar replicación)
80
83
81
84
Example: ``log.set_mirroring(True)``
82
85
83
-
Mirroring is disabled by default.
86
+
Serial mirroring is disabled by default. When enabled, it will print to serial each row logged into the log file.
84
87
85
-
:param serial: (serie) Si se le pasa ``True`` (verdadero), replicará la actividad del registro de datos en la salida serie; si se le pasa ``False`` (falso), se desactivará la replicación."""
88
+
:param serial: (serie) ``True`` enables mirroring data to the serial output."""
Copy file name to clipboardExpand all lines: lang/es-es/typeshed/stdlib/microbit/accelerometer.pyi
+16-1Lines changed: 16 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,14 @@ Example: ``x, y, z = accelerometer.get_values()``
33
33
:return: a three-element tuple of integers ordered as X, Y, Z, each value a positive or negative integer depending on direction in the range +/- 2000mg"""
34
34
...
35
35
36
+
defget_strength() ->int:
37
+
"""Get the acceleration measurement of all axes combined, as a positive integer. This is the Pythagorean sum of the X, Y and Z axes.
38
+
39
+
Example: ``accelerometer.get_strength()``
40
+
41
+
:return: The combined acceleration strength of all the axes, in milli-g."""
42
+
...
43
+
36
44
defcurrent_gesture() ->str:
37
45
"""Obtiene el nombre del gesto actual. (gesto actual)
38
46
@@ -85,4 +93,11 @@ calls to some accelerometer method to do the gesture detection. Usually
85
93
gestures can be detected using a loop with a small :func:`microbit.sleep` delay.
86
94
87
95
:return: The history as a tuple, most recent last."""
88
-
...
96
+
...
97
+
98
+
defset_range(value: int) ->None:
99
+
"""Set the accelerometer sensitivity range, in g (standard gravity), to the closest values supported by the hardware, so it rounds to either ``2``, ``4``, or ``8`` g.
100
+
101
+
Example: ``accelerometer.set_range(8)``
102
+
103
+
:param value: (valor) New range for the accelerometer, an integer in ``g``."""
"""Play a built-in sound, sound effect or custom audio frames. (reproducir)
7
7
8
8
Example: ``audio.play(Sound.GIGGLE)``
9
9
10
-
:param source: (origen) Un ``Sound`` predefinido como ``Sound.GIGGLE`` o datos de muestra como un iterable de objetos ``AudioFrame``.
10
+
:param source: (origen) A built-in ``Sound`` such as ``Sound.GIGGLE``, a ``SoundEffect`` or sample data as an iterable of ``AudioFrame`` objects.
11
11
:param wait: (esperar) Si ``wait`` es ``True`` (verdadero), la función se bloqueará hasta que el sonido finalice.
12
12
:param pin: Se puede usar un argumento opcional para especificar el pin de salida, reemplazando el valor predeterminado de ``pin0``. Si no queremos que se reproduzca ningún sonido, podemos usar ``pin=None``.
13
13
:param return_pin: (devolver pin) Especifica un pin de conector de borde diferencial para conectarse a un altavoz externo en lugar de tierra. Esto se ignora para la revisión **V2**."""
@@ -26,6 +26,75 @@ def stop() -> None:
26
26
Example: ``audio.stop()``"""
27
27
...
28
28
29
+
classSoundEffect:
30
+
"""A sound effect, composed by a set of parameters configured via the constructor or attributes."""
31
+
WAVEFORM_SINE: ClassVar[int]
32
+
"""Sine wave option used for the ``waveform`` parameter."""
33
+
WAVEFORM_SAWTOOTH: ClassVar[int]
34
+
"""Sawtooth wave option used for the ``waveform`` parameter."""
35
+
WAVEFORM_TRIANGLE: ClassVar[int]
36
+
"""Triangle wave option used for the ``waveform`` parameter."""
37
+
WAVEFORM_SQUARE: ClassVar[int]
38
+
"""Square wave option used for the ``waveform`` parameter."""
39
+
WAVEFORM_NOISE: ClassVar[int]
40
+
"""Noise option used for the ``waveform`` parameter."""
41
+
SHAPE_LINEAR: ClassVar[int]
42
+
"""Linear interpolation option used for the ``shape`` parameter."""
43
+
SHAPE_CURVE: ClassVar[int]
44
+
"""Curve interpolation option used for the ``shape`` parameter."""
45
+
SHAPE_LOG: ClassVar[int]
46
+
"""Logarithmic interpolation option used for the ``shape`` parameter."""
47
+
FX_NONE: ClassVar[int]
48
+
"""No effect option used for the ``fx`` parameter."""
49
+
FX_TREMOLO: ClassVar[int]
50
+
"""Tremelo effect option used for the ``fx`` parameter."""
51
+
FX_VIBRATO: ClassVar[int]
52
+
"""Vibrato effect option used for the ``fx`` parameter."""
53
+
FX_WARBLE: ClassVar[int]
54
+
"""Warble effect option used for the ``fx`` parameter."""
55
+
freq_start: int
56
+
"""Start frequency in Hertz (Hz), a number between ``0`` and ``9999``"""
57
+
freq_end: int
58
+
"""End frequency in Hertz (Hz), a number between ``0`` and ``9999``"""
59
+
duration: int
60
+
"""Duration of the sound in milliseconds, a number between ``0`` and ``9999`` (duración)"""
61
+
vol_start: int
62
+
"""Start volume value, a number between ``0`` and ``255``"""
63
+
vol_end: int
64
+
"""End volume value, a number between ``0`` and ``255``"""
65
+
waveform: int
66
+
"""Type of waveform shape, one of these values: ``WAVEFORM_SINE``, ``WAVEFORM_SAWTOOTH``, ``WAVEFORM_TRIANGLE``, ``WAVEFORM_SQUARE``, ``WAVEFORM_NOISE`` (randomly generated noise)"""
67
+
fx: int
68
+
"""Effect to add on the sound, one of the following values: ``FX_TREMOLO``, ``FX_VIBRATO``, ``FX_WARBLE``, or ``FX_NONE``"""
69
+
shape: int
70
+
"""The type of the interpolation curve between the start and end frequencies, different wave shapes have different rates of change in frequency. One of the following values: ``SHAPE_LINEAR``, ``SHAPE_CURVE``, ``SHAPE_LOG``"""
All the parameters are optional, with default values as shown above, and
78
+
they can all be modified via attributes of the same name. For example, we
79
+
can first create an effect ``my_effect = SoundEffect(duration=1000)``,
80
+
and then change its attributes ``my_effect.duration = 500``.
81
+
82
+
:param freq_start: Start frequency in Hertz (Hz), a number between ``0`` and ``9999``.
83
+
:param freq_end: End frequency in Hertz (Hz), a number between ``0`` and ``9999``.
84
+
:param duration: (duración) Duration of the sound in milliseconds, a number between ``0`` and ``9999``.
85
+
:param vol_start: Start volume value, a number between ``0`` and ``255``.
86
+
:param vol_end: End volume value, a number between ``0`` and ``255``.
87
+
:param waveform: Type of waveform shape, one of these values: ``WAVEFORM_SINE``, ``WAVEFORM_SAWTOOTH``, ``WAVEFORM_TRIANGLE``, ``WAVEFORM_SQUARE``, ``WAVEFORM_NOISE`` (randomly generated noise).
88
+
:param fx: Effect to add on the sound, one of the following values: ``FX_TREMOLO``, ``FX_VIBRATO``, ``FX_WARBLE``, or ``FX_NONE``.
89
+
:param shape: The type of the interpolation curve between the start and end frequencies, different wave shapes have different rates of change in frequency. One of the following values: ``SHAPE_LINEAR``, ``SHAPE_CURVE``, ``SHAPE_LOG``."""
90
+
91
+
defcopy(self) ->SoundEffect:
92
+
"""Create a copy of this ``SoundEffect``. (copiar)
93
+
94
+
Example: ``sound_2 = sound_1.copy()``
95
+
96
+
:return: A copy of the SoundEffect."""
97
+
29
98
classAudioFrame:
30
99
"""Un objeto ``AudioFrame`` es una lista de 32 muestras, cada una de las cuales es un byte
31
100
sin signo (número entero entre 0 y 255).
@@ -38,6 +107,13 @@ Example::
38
107
for i in range(len(frame)):
39
108
frame[i] = 252 - i * 8"""
40
109
110
+
defcopyfrom(self, other: AudioFrame) ->None:
111
+
"""Overwrite the data in this ``AudioFrame`` with the data from another ``AudioFrame`` instance.
112
+
113
+
Example: ``my_frame.copyfrom(source_frame)``
114
+
115
+
:param other: (otro) ``AudioFrame`` instance from which to copy the data."""
The program state is preserved and when it wakes up it will resume operation where it left off.
35
+
36
+
Deep Sleep mode will consume more battery power than Off mode.
37
+
38
+
The wake up sources are configured via arguments.
39
+
40
+
If no wake up sources have been configured it will sleep until the reset button is pressed (which resets the Target MCU) or, in battery power, when the USB cable is inserted.
41
+
42
+
When the ``run_every`` parameter is set to ``True`` (the default), any function scheduled with ``microbit.run_every`` will still run while the board sleeps. When the scheduled time is reached the micro:bit will momentarily wake up to run the scheduled function and then automatically go back to sleep.
43
+
44
+
:param ms: A time in milliseconds to wait before it wakes up.
45
+
:param wake_on: A single instance or a tuple of pins and/or buttons to wake up the board, e.g. ``deep_sleep(wake_on=button_a)`` or ``deep_sleep(wake_on=(pin0, pin2, button_b))``.
46
+
:param run_every: A boolean to configure if the functions scheduled with ``microbit.run_every`` will continue to run while it sleeps.
0 commit comments