Skip to content

ACC-HelloWorld/2-blink-and-read

Repository files navigation

Blink and Read

Write scripts to control an RGB LED and read data from an AS7341 color sensor.

The assignment

Update blink.py to control a single RGB LED and read.py to read sensor data from the AS7341. Each script is worth five points. A number of dummy modules are installed by default (via pip install -e .) to allow you to run tests without the microcontroller. This makes it easy to test on Codespaces and this is also where the autograding will be carried out. Periodically, you can copy the contents from your Pico W back to Codespaces run the pytest command.

Running on the Pico W

Steps:

  1. Ensure that MicroPython is installed on your Pico W
  2. In Codespaces, download the lib/ folder, blink.py, and read.py by right-clicking and selecting "Download". Then, in Thonny, copy lib, blink.py, and read.py to your microcontroller. Watch the video below for a demonstration.

▶️ File transfer

  1. Ensure that your Pico W is inserted correctly into the Maker Pi Pico base
  2. Ensure that your AS7341 is connected to Grove Port #6
  3. Edit the two scripts to meet the specifications in the sections below
  4. Run the scripts directly in Thonny by opening the script and clicking the play button

Blink

Follow the directions on blink.py. You will use the RGB LED housed on the Maker Pi Pico base, which is connected to Pin #28 on the Pico W microcontroller. Turn the LEDs on to a color of your choice, sleep for 2 seconds, and then turn off the LEDs.

Read

Update read.py so that it returns a dictionary that maps the name to the value for each of the channel wavelengths. Use the Sensor class from the as7341_sensor.py module to read the data.

Run command

pytest

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published