diff --git a/Custom Visualizer b/Custom Visualizer new file mode 100644 index 0000000..81d6a5a --- /dev/null +++ b/Custom Visualizer @@ -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) diff --git a/README.md b/README.md index e61ff2f..9bbbc55 100644 --- a/README.md +++ b/README.md @@ -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