def report(name, label_name, nb_pictures, flash_power): # Initialize i2c bus i2c = busio.I2C(board.SCL, board.SDA) display = adafruit_is31fl3731.CharlieBonnet(i2c) # Initialize raspberry camera camera = PiCamera() number = 0 extension = '.jpg' # Start taking pictures for i in range(int(nb_pictures)): display.fill(int(flash_power)) camera.start_preview() #time.sleeip(2) pictureName = name + str(number) + extension camera.capture(pictureName) upload_file(pictureName) uri = "gs://" + bucket_name + "/" + project_folder_name + "/" + pictureName write_csv_file(uri, label_name) number = number + 1 display.fill(0) # Upload csv file on google storage upload_file(csv_file) os.remove(csv_file)
Author(s): Melissa LeBlanc-Williams for Adafruit Industries """ import board from PIL import Image, ImageDraw, ImageFont import adafruit_is31fl3731 BRIGHTNESS = 32 # Brightness can be between 0-255 i2c = board.I2C() # uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix # display = adafruit_is31fl3731.Matrix(i2c) # uncomment line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix display = adafruit_is31fl3731.CharlieBonnet(i2c) display.fill(0) # 256 Color Grayscale Mode image = Image.new("L", (display.width, display.height)) draw = ImageDraw.Draw(image) # Load a font in 2 different sizes. font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 10) # Load the text in each frame for x in range(8): draw.rectangle((0, 0, display.width, display.height), outline=0, fill=0) draw.text((x + 1, -2), str(x + 1), font=font, fill=BRIGHTNESS)
#!/usr/bin/python3 #This was written and designed for a 16x8 adafruit led screen, #therefore your mileage may very but if one wanted to, one #*should* be able to tweak this a little bit import atexit import time import busio import board import adafruit_is31fl3731 import datetime import sys #The following is to shorten what would be datetime.datetime.now() from datetime import datetime i2c = busio.I2C(board.SCL, board.SDA) #Change what the screen is here for whichever screen you have screen = adafruit_is31fl3731.CharlieBonnet(i2c) screen.blink(1100) #This is so that all of the numbers may be broken up into sections #that are 3(horrizontal) or 4(vertical) pixels long #x,y: the initial coordinates for the start of the line #b: the brightness of the pixel (controlled by the bright() function #orr: orientation, 1:horrizontal, 0 vertical def bit(x, y, b, orr): if (orr == 0): screen.pixel(x, y, b) screen.pixel(x, y - 1, b) screen.pixel(x, y - 2, b) screen.pixel(x, y - 3, b) else: