Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LAB 1: Sarah Malott #74

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions Custom Visualizer
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import board
import busio
import adafruit_apds9960.apds9960
import neopixel
import time
import analogio
import digitalio
import usb_hid
from adafruit_hid.mouse import Mouse

mouse = Mouse(usb_hid.devices)

i2c = board.STEMMA_I2C()
pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)

x_axis = analogio.AnalogIn(board.A0)
y_axis = analogio.AnalogIn(board.A1)
select = digitalio.DigitalInOut(board.A2)
select.direction = digitalio.Direction.INPUT
select.pull = digitalio.Pull.UP

sensor = adafruit_apds9960.apds9960.APDS9960(i2c)
sensor.enable_color = True
sensor.color_integration_time = 50

pot_min = 0.00
pot_max = 3.29
step = (pot_max - pot_min) / 20.0

while True:
while sensor.color_data_ready:
r, g, b, c = sensor.color_data
print('Red: {0}, Green: {1}, Blue: {2}, Clear: {3}'.format(r, g, b, c))
if c < 100:
# print(steps(x))
mouse.move(y=0)
elif c >= 4000:
# print(steps(x))
mouse.move(y=-10)
if r >= 100 and b <= 200:
mouse.move (x=-20)
elif r >= 100 and b >= 250:
mouse.move (x=20)
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
University of Pennsylvania, ESE 5190: Intro to Embedded Systems, Lab 1

(TODO) YOUR NAME HERE
(TODO) LinkedIn, personal website, twitter, etc.
(TODO) Sarah Malott
Tested on: (TODO) MacBook Pro (14-inch, 2021), macOS Monterey 12.5.1

(TODO: Your README)

Include lab questions, screenshots, analysis, etc. (Remember, this is public, so don't put anything here you don't want to share with the world.)
Color Shifting Embedded System:
The user moves the cursor back on forth on http://color.aurlien.net/ to display different colors, and the colors at both ends of the spectrum trigger the mouse on a seperate PC to move in the same direction as the first mouse.

![image](https://user-images.githubusercontent.com/114248720/192078763-2d4b973f-5f94-45c3-8a5c-81b638d55135.png)

Videos available here: https://drive.google.com/drive/folders/1DCuWp-28cbp0KpLMAjRtt-Upoq-gCnAp?usp=sharing