This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import smbus | |
| import time | |
| class Worm : | |
| global bus | |
| global address | |
| bus = smbus.SMBus(1) | |
| address = 0x40 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv2 | |
| capture = cv2.VideoCapture(0) | |
| capture.set(3, 320) #set width of frame | |
| capture.set(4, 200) #set hieght of frame | |
| capture.set(5, 20) #set FPS | |
| capture.set(10, 20) #set brightness | |
| successful = True | |
| while successful: | |
| successful, image = capture.read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from picamera.array import PiRGBArray | |
| from picamera import PiCamera | |
| import time | |
| import cv2 | |
| import numpy as np | |
| import RPi.GPIO as GPIO | |
| GPIO.setmode(GPIO.BOARD) | |
| GPIO.setup(40, GPIO.OUT) | |
| GPIO.output(40, GPIO.HIGH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sensor.SetMode(1,4) | |
| Sensor.SetMode(4,4) | |
| Red_min[0] = 230 | |
| Red_min[1] = 40 | |
| Red_min[2] = 10 | |
| Red_max[0] = 350 | |
| Red_max[1] = 90 | |
| Red_max[2] = 70 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from picamera.array import PiRGBArray | |
| from picamera import PiCamera | |
| import time | |
| import cv2 | |
| import numpy as np | |
| import RPi.GPIO as GPIO | |
| GPIO.setmode(GPIO.BOARD) | |
| GPIO.setup(40, GPIO.OUT) | |
| GPIO.output(40, GPIO.HIGH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sensor.SetMode(1,4) | |
| Sensor.SetMode(4,4) | |
| Red_min[0] = 230 | |
| Red_min[1] = 40 | |
| Red_min[2] = 10 | |
| Red_max[0] = 350 | |
| Red_max[1] = 90 | |
| Red_max[2] = 70 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from picamera.array import PiRGBArray | |
| from picamera import PiCamera | |
| import time | |
| import cv2 | |
| import numpy as np | |
| import RPi.GPIO as GPIO | |
| GPIO.setmode(GPIO.BOARD) | |
| GPIO.setup(40, GPIO.OUT) | |
| GPIO.output(40, GPIO.HIGH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from picamera.array import PiRGBArray | |
| from picamera import PiCamera | |
| import time | |
| import cv2 | |
| import numpy as np | |
| import RPi.GPIO as GPIO | |
| GPIO.setmode(GPIO.BOARD) | |
| GPIO.setup(40, GPIO.OUT) | |
| GPIO.output(40, GPIO.HIGH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sensor.SetMode(1,4) | |
| Sensor.SetMode(4,4) | |
| Red_min[0] = 230 | |
| Red_min[1] = 40 | |
| Red_min[2] = 10 | |
| Red_max[0] = 350 | |
| Red_max[1] = 90 | |
| Red_max[2] = 70 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'initilize the 2 ultra sonic sensors in port 1 and 4 in mode 0 | |
| Sensor.SetMode(1,0) | |
| Sensor.SetMode(4,0) | |
| 'initilize varibles | |
| distance = 800 | |
| dir = "left" | |
| speed = 20 | |
| 'play the recorded into sound file, this canm be removed if you don't have a recorded intro sound file | |
| Speaker.Play(100,"Sounds/Robo Dog/Intro Dog") |
NewerOlder