This file contains 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
'First 55 lines of code are to open and read from a file that was written by the cube recognition program | |
'The recongition program was written in python running on a raspberry pi | |
'It was orginally intended that it would run as a webserver using flask and this Small Basic program would use the Network.GetWebPageContents to get the data | |
'the file has 12 lines, 6 sets of 2 pairs of lines. First line is which face it is and the second line is a string of 9 char of the colors of that face | |
'We have 6 arrays that are 2 dimentional 3 x 3 (row,colum) to store the colors | |
For line = 1 To 6 | |
dataface = File.ReadLine("C:\Data\Robitics\MacTwist.txt",line*2-1) | |
datatile = File.ReadLine("C:\Data\Robitics\MacTwist.txt",line*2) |
This file contains 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") |
This file contains 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 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 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 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 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 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 PiYUVArray | |
from picamera import PiCamera | |
import time | |
import cv2 | |
import numpy as np | |
import colorsys | |
#set Pi Camera settings | |
camera = PiCamera() | |
camera.resolution = (640, 480) |
This file contains 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 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) |
OlderNewer