There are going to be great places to leverage AI, and others that are not so satisfying. Its human nature to weigh the value of everything. (I could use EXCEL to help me create a grocery list too, but I usually use a scrap of paper. EXCEL just seems unnecessary). In this generation of AI for most of us, the human element is always *implied*. It's a time saver to be sure, but not a replacement for human innovation. Now other commercial applications are already using AI to "drive the car" which is full on AI. That is another whole level of AI discussions, and various applications of it. AI for these all-in applications may also have philosophical and legal concerns as well since human safety is involved. But there are some great uses of AI today....
Take for example the hobbyist that wants to get started with LED strips and a Raspberry Pi. Maybe looking for the means to drive an LED pixel strip with patterns. I entered the command: "write some code in micropython that will allow various patterns to be displayed on a ws2812b led strip connected to pin 16 on a raspberry pi pico" and I posted below the results. Is this the END every hobbiest was looking for? No, but it sure gave a head-start and gets the strip doing something. From here, the rest of the coding is up to the hobbyist , who surely appreciates the start.
import time
import neopixel
# Set the number of LEDs in the strip.
num_leds = 10
# Create a NeoPixel object on pin 16.
strip = neopixel.NeoPixel(board.GP16, num_leds)
# Define a function to set the color of an LED.
def set_pixel_color(pixel, red, green, blue):
strip[pixel] = (red, green, blue)
# Define a function to cycle through all the colors in the rainbow.
def rainbow():
for i in range(num_leds):
hue = (i * 360) / num_leds
rgb = neopixel.Color(hue, 1, 1)
set_pixel_color(i, rgb.red, rgb.green, rgb.blue)
# Define a function to flash all the LEDs red.
def flash_red():
for i in range(3):
for pixel in range(num_leds):
set_pixel_color(pixel, 255, 0, 0)
time.sleep(1)
for pixel in range(num_leds):
set_pixel_color(pixel, 0, 0, 0)
time.sleep(1)
# Define a function to blink all the LEDs green.
def blink_green():
for i in range(3):
for pixel in range(num_leds):
set_pixel_color(pixel, 0, 255, 0)
time.sleep(1)
for pixel in range(num_leds):
set_pixel_color(pixel, 0, 0, 0)
time.sleep(1)
# Define a function to fade all the LEDs from red to blue.
def fade_red_to_blue():
for i in range(256):
for pixel in range(num_leds):
set_pixel_color(pixel, i, 0, 255 - i)
time.sleep(0.01)
# Define a function to cycle through all the patterns.
def cycle_patterns():
while True:
rainbow()
time.sleep(2)
flash_red()
time.sleep(2)
blink_green()
time.sleep(2)
fade_red_to_blue()
time.sleep(2)
# Start the cycle patterns function.
cycle_patterns()