아두이노 초음파센서 4개, 부저 RGB LED 4개
50 < distance 이면 led 꺼짐 추가 #include //LCD 라이브러리 추가 //LiquidCrystal lcd(RS, Enable, DB4, DB5, DB6, DB7); LiquidCrystal lcd(40, 41, 42, 43, 44, 45); int go = 52; //buzzer int trigPin1 = 23; //후방 int echoPin1 = 22; int red1 = 10; int grn1 = 9; int blu1 = 8; int trigPin2 = 24; //전방 int echoPin2 = 25; int red2 = 13; int grn2 = 12; int blu2 = 11; int trigPin3 = 32; //좌 int echoPin3 = 33; int red3 = 7;..
2021. 1. 22.
ATmega128 공통음극 캐소드 MT03911AR 7세그먼트
책에있는 코드인데 안된다 . 책대로 연결했는데 왜 안되는지 모르겠음 .. /* * FNDexample.c * * Created: 2020-12-07 오전 9:31:46 * Author : User */ #include unsigned char digit[] = {0x77, 0x41, 0x3B, 0x5B, 0x4D, 0x5E, 0x7C, 0x43, 0x7F, 0x4F}; void display_7segled(unsigned char led[], unsigned int number){ PORTB = led[number]; } int main(void) { DDRB = 0xFF; display_7segled(digit, 4); return 0; } 그래서 아래처럼 한칸씩 켜보고 직접 짜보기로함 #include..
2021. 1. 21.
if x<80 : print('right') elif x>300 : print('left')
import cv2 import numpy as np cap = cv2.VideoCapture("1eun2.mp4") while True: ret, frame = cap.read() if ret is False: break roi = frame[100: 795, 700: 1300] rows, cols, _ = roi.shape gray_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY) gray_roi = cv2.GaussianBlur(gray_roi, (7, 7), 0) _, threshold = cv2.threshold(gray_roi, 30, 255, cv2.THRESH_BINARY_INV) _, contours, _ = cv2.findContours(threshold, ..
2021. 1. 20.
0eun, 주석 포함 코드, 주석 삭제한 코드
import cv2 import numpy as np cap = cv2.VideoCapture("0eun.mp4") while True: ret, frame = cap.read() if ret is False: break roi = frame[100: 795, 537: 1300] rows, cols, _ = roi.shape gray_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY) gray_roi = cv2.GaussianBlur(gray_roi, (7, 7), 0) _, threshold = cv2.threshold(gray_roi, 30, 255, cv2.THRESH_BINARY_INV) _, contours, _ = cv2.findContours(threshold, c..
2021. 1. 19.
실시간 영상 대신 촬영한 영상 불러오는 코드. 가로세로줄 뜸
import cv2 import numpy as np cap = cv2.VideoCapture("Rack.mp4") while True: ret, frame = cap.read() if ret is False: break roi = frame[100: 795, 537: 1416] rows, cols, _ = roi.shape gray_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY) gray_roi = cv2.GaussianBlur(gray_roi, (7, 7), 0) _, threshold = cv2.threshold(gray_roi, 5, 255, cv2.THRESH_BINARY_INV) _, contours, _ = cv2.findContours(threshold, cv..
2021. 1. 19.