@@ -208,11 +208,33 @@ def sequence(self) -> "_DRV2605_Sequence":
208
208
"""
209
209
return self ._sequence
210
210
211
- def set_realtime_value (self , val : int ) -> None :
212
- """Set the output value used for Real-Time Playback. By default, the device
213
- interprets the value as SIGNED (2s complement), and its effect depends on
214
- other operating parameters. Consult the datasheet for more information!
211
+ @property
212
+ def realtime_value (self ) -> int :
213
+ """The output value used in Real-Time Playback mode. When the device is
214
+ switched to ``MODE_REALTIME``, the motor is driven continuously with an
215
+ amplitude/direction determined by this value.
216
+
217
+ By default, the device interprets it as SIGNED (2s complement), and its exact
218
+ effect depends on other operating parameters.
219
+
220
+ See the datasheet for more information!
221
+
222
+ E.g.:
223
+
224
+ .. code-block:: python
225
+
226
+ # Configure the output amplitude to 50%
227
+ drv.realtime_value = 64
228
+
229
+ # Buzz the motor briefly
230
+ drv.mode = adafruit_drv2605.MODE_REALTIME
231
+ time.sleep(0.25)
232
+ drv.mode = adafruit_drv2605.MODE_INTTRIG
215
233
"""
234
+ return self ._read_u8 (_DRV2605_REG_RTPIN )
235
+
236
+ @realtime_value .setter
237
+ def realtime_value (self , val : int ) -> None :
216
238
if not 0 <= val <= 255 :
217
239
raise ValueError ("Real-Time Playback value must be a value within 0-255!" )
218
240
self ._write_u8 (_DRV2605_REG_RTPIN , val )
0 commit comments