Project 3: Emotive Object Project 3 Document Requirements At least one sensor At least one motor/servo At least one behavior Express an emotion somehow Initial thoughts: I nspiration: Inflatable tube guy to express joy with a proximity sensor --> did not want to include a fan, so will make waving cardboard arms to emulate that Programming practice: turning on a light with the raspberry pi pico Code: from machine import Pin import time led = Pin(17, Pin.OUT) while True: led.toggle() #can also use led.value(1) for on, 0 for off time.sleep(1) #in seconds
Project 1: Digital Surrealist Object Project 1 Document Requirements: Start from a found object Create a 3D printed extension of the object Purpose of the object must be transformed Still unsure about what object to use... thinking of going to the thrift store to find an object and inspiration. Activity: Project 1 Activity Sketches
Connecting servo motors: Code to move servos: from servo import Servo import time sg90_servo = Servo(pin=26) #To be changed according to the pin used servo2 = Servo(pin=22) while True: sg90_servo.move(135) # turns the servo to 0°. servo2.move(45) time.sleep(1) #sg90_servo.move(90) # turns the servo to 90°. #servo2.move(90) #time.sleep(1) #sg90_servo.move(180) # turns the servo to 180°. #time.sleep(1) Code to make servos wiggle with proximity sensor: from machine import Pin from servo import Servo import utime import time trigger = Pin(27, Pin.OUT) echo = Pin(28, Pin.IN) sg90_servo = Servo(pin=26) def ultra(): trigger.low() utime.sleep_us(2) trigger.high() utime.sleep_us(5) trigger.low() while echo.value() == 0: signaloff = utime.ticks_us() ...
Comments
Post a Comment