@@ -109,8 +109,6 @@ class PyBadgerBase:
109109 BLINKA_PURPLE = (102 , 45 , 145 )
110110 BLINKA_PINK = (231 , 33 , 138 )
111111
112- RAINBOW = (RED , ORANGE , YELLOW , GREEN , BLUE , PURPLE )
113-
114112 # Button Constants
115113 BUTTON_LEFT = const (128 )
116114 BUTTON_UP = const (64 )
@@ -121,7 +119,7 @@ class PyBadgerBase:
121119 BUTTON_A = const (2 )
122120 BUTTON_B = const (1 )
123121
124- def __init__ (self , * , pixels_brightness = 1.0 ):
122+ def __init__ (self ):
125123 self ._light_sensor = None
126124 self ._accelerometer = None
127125 self ._label = label
@@ -137,7 +135,7 @@ def __init__(self, *, pixels_brightness=1.0):
137135
138136 # NeoPixels
139137 self ._neopixels = neopixel .NeoPixel (board .NEOPIXEL , self ._neopixel_count ,
140- brightness = pixels_brightness , pixel_order = neopixel .GRB )
138+ brightness = 1 , pixel_order = neopixel .GRB )
141139
142140 # Auto dim display based on movement
143141 self ._last_accelerometer = None
@@ -199,6 +197,9 @@ def badge_background(self, background_color=(255, 0, 0), rectangle_color=(255, 2
199197 pybadger.badge_background(background_color=pybadger.WHITE,
200198 rectangle_color=pybadger.PURPLE,
201199 rectangle_drop=0.2, rectangle_height=0.6)
200+
201+ while True:
202+ pybadger.show()
202203 """
203204 self ._background_group = self ._badge_background (background_color , rectangle_color ,
204205 rectangle_drop , rectangle_height )
@@ -233,6 +234,9 @@ def image_background(self, image_name=None):
233234 from adafruit_pybadger import pybadger
234235
235236 pybadger.image_background("Blinka.bmp")
237+
238+ while True:
239+ pybadger.show()
236240 """
237241 self ._background_image_filename = image_name
238242
@@ -262,19 +266,17 @@ def badge_line(self, text=" ", color=(0, 0, 0), scale=1, font=terminalio.FONT,
262266 rectangle_color=pybadger.PURPLE,
263267 rectangle_drop=0.2, rectangle_height=0.6)
264268
265- pybadger.badge_line(text="@blinka", color=pybadger.BLINKA_PURPLE, scale=4,
266- padding_above=1)
267- pybadger.badge_line(text="Blinka", color=pybadger.WHITE, scale=5,
269+ pybadger.badge_line(text="@circuitpython", color=pybadger.BLINKA_PURPLE, scale=2,
268270 padding_above=2)
271+ pybadger.badge_line(text="Blinka", color=pybadger.WHITE, scale=5,
272+ padding_above=3)
269273 pybadger.badge_line(text="CircuitPython", color=pybadger.WHITE, scale=3,
270274 padding_above=1)
271275 pybadger.badge_line(text="she/her", color=pybadger.BLINKA_PINK, scale=4,
272276 padding_above=4)
273277
274- pybadger.show()
275-
276278 while True:
277- pass
279+ pybadger.show()
278280 """
279281 if isinstance (font , str ):
280282 font = load_font (font , text )
@@ -314,8 +316,7 @@ def badge_line(self, text=" ", color=(0, 0, 0), scale=1, font=terminalio.FONT,
314316 self ._y_position += height * scale + 4
315317
316318 def show (self ):
317- """Call ``show()`` to display the badge lines of text."""
318-
319+ """Call ``pybadger.show()`` to display the custom badge elements."""
319320 if not self ._created_background :
320321 self ._create_badge_background ()
321322
@@ -357,6 +358,12 @@ def auto_dim_display(self, delay=5.0, movement_threshold=10):
357358 :param int movement_threshold: Threshold required for movement to be considered stopped.
358359 Change to increase or decrease sensitivity.
359360
361+ .. code-block:: python
362+
363+ from adafruit_pybadger import pybadger
364+
365+ while True:
366+ pybadger.auto_dim_display(delay=10)
360367 """
361368 if not self ._check_for_movement (movement_threshold = movement_threshold ):
362369 current_time = time .monotonic ()
@@ -383,7 +390,7 @@ def acceleration(self):
383390
384391 @property
385392 def brightness (self ):
386- """Display brightness."""
393+ """Display brightness. Must be a value between ``0`` and ``1``. """
387394 return self .display .brightness
388395
389396 @brightness .setter
@@ -417,6 +424,14 @@ def show_business_card(self, *, image_name=None, name_string=None, name_scale=1,
417424 :param email_font_two: The font for the second email string. Defaults to
418425 ``terminalio.FONT``.
419426
427+ .. code-block:: python
428+ from adafruit_pybadger import pybadger
429+
430+ while True:
431+ pybadger.show_business_card(image_name="Blinka.bmp", name_string="Blinka",
432+ name_scale=2, email_string_one="blinka@",
433+ email_string_two="adafruit.com")
434+
420435 """
421436 business_card_label_groups = []
422437 if name_string :
@@ -480,6 +495,14 @@ def show_badge(self, *, background_color=(255, 0, 0), foreground_color=(255, 255
480495 :param name_string: The third string of the badge - change to be your name. Defaults to
481496 "Blinka".
482497
498+ .. code-block:: python
499+
500+ from adafruit_pybadger import pybadger
501+
502+ while True:
503+ pybadger.show_badge(name_string="Blinka", hello_scale=2, my_name_is_scale=2,
504+ name_scale=3)
505+
483506 """
484507 hello_group = self ._create_label_group (text = hello_string ,
485508 font = hello_font ,
@@ -528,11 +551,18 @@ def bitmap_qr(matrix):
528551 bitmap [x + border_pixels , y + border_pixels ] = 0
529552 return bitmap
530553
531- def show_qr_code (self , * , data = "https://circuitpython.org" ):
532- """Generate a QR code and display it for ``dwell`` seconds .
554+ def show_qr_code (self , data = "https://circuitpython.org" ):
555+ """Generate a QR code.
533556
534557 :param string data: A string of data for the QR code
535558
559+ .. code-block:: python
560+
561+ from adafruit_pybadger import pybadger
562+
563+ while True:
564+ pybadger.show_qr_code("https://adafruit.com")
565+
536566 """
537567 qr_code = adafruit_miniqr .QRCode (qr_type = 3 , error_correct = adafruit_miniqr .L )
538568 qr_code .add_data (bytearray (data ))
@@ -585,7 +615,7 @@ def play_tone(self, frequency, duration):
585615
586616 def start_tone (self , frequency ):
587617 """ Produce a tone using the speaker. Try changing frequency to change
588- the pitch of the tone.
618+ the pitch of the tone. Use ``stop_tone`` to stop the tone.
589619
590620 :param int frequency: The frequency of the tone in Hz
591621
@@ -601,7 +631,7 @@ def start_tone(self, frequency):
601631 self ._sample .play (self ._sine_wave_sample , loop = True )
602632
603633 def stop_tone (self ):
604- """ Use with start_tone to stop the tone produced.
634+ """ Use with `` start_tone`` to stop the tone produced.
605635 """
606636 # Stop playing any tones.
607637 if self ._sample is not None and self ._sample .playing :
0 commit comments