Week 23. Feb 4.8 2019 - michelle-qin/Portfolio GitHub Wiki
Because the board fried last time (due to shorting), we ordered a new one. I re-downloaded all the libraries that were on the previous board. I bumped into some difficulty during this process, as I (kinda) forgot the libraries that I had downloaded previously. So, in case a similar situation occurs in the future, here are the folders that I downloaded:
-
Here is the link for the Adafruit Circuitpython library bundle (if you have trouble with no space, then download the library into your Downloads folder and delete folder "examples" - you don't need it. All I took was "lib"): https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries
-
Clone Adafruit_CircuitPython_ServoKit & 3 Dependencies (Adafruit CircuitPython, BusDevice, Register): https://github.com/adafruit/Adafruit_CircuitPython_ServoKit
-
Controlling Servo with Featherwing tutorial: https://learn.adafruit.com/adafruit-8-channel-pwm-or-servo-featherwing/circuitpython
Searches from Kinetic Maze research: motion sensing 3D camera for raspberry pi logitech hd webcam c270 what camera to use with open cv and raspberry pi
Coded the Featherwing to move servo with proximity sensor (i.e. is metal is detected by the sensor, the motor will move). My code is below:
from adafruit_servokit import ServoKit
from time import sleep
import board
from digitalio import DigitalInOut, Direction, Pull
kit = ServoKit(channels=8)
# For Gemma M0, Trinket M0, Metro M0 Express, ItsyBitsy M0 Express, Itsy M4 Express
sensor = DigitalInOut(board.D5)
# switch = DigitalInOut(board.D5) # For Feather M0 Express, Feather M4 Express
# switch = DigitalInOut(board.D7) # For Circuit Playground Express
sensor.direction = Direction.INPUT
sensor.pull = Pull.UP
j = 0
while True:
# We could also do "led.value = not switch.value"!
if sensor.value:
print("Hello")
else:
if (j%2 == 0):
kit.servo[0].angle = 180
else:
kit.servo[0].angle = 0
sleep(0.01) # debounce delay
j = j + 1
Update on kinetic wall project: We set the raspberry pi up and I was following a tutorial to install OpenCV 4.0 on the pi made by Learn OpenCV. I reached an error on step 4 with the line "git checkout." We are currently looking into it.
For the Ball Wall: I added a DC motor and stepper motor and wrote code to move those with the proxim sensor.