Skip to content

Instantly share code, notes, and snippets.

View Park-Developer's full-sized avatar
🎯
Focusing

Park_Daniel Park-Developer

🎯
Focusing
  • South Korea
View GitHub Profile
@Park-Developer
Park-Developer / pipe.c
Last active February 6, 2022 06:24
Linux : pipe()
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h> //waitpid() 함수를 위해 사용
int main(int argc, char **argv){
pid_t pid;
int pfd[2];
char line[BUFSIZ]; // <stdio.h> 파일에 정의된 버퍼 크기로 결정
int status;
@Park-Developer
Park-Developer / ultrasonic.c
Created February 5, 2022 18:38
ultrasonic sensor with C
#include<stdio.h>
#include<wiringPi.h>
#define TRIG 21 // trig GPIO 5
#define ECHO 22 // echo GPIO 6
int main(void){
long startTime;
long travelTime;
int distance=0;
@Park-Developer
Park-Developer / udp_client.py
Created January 19, 2022 13:34
Bot udp_client
import socket
sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
while True:
#Error Case
#print("wait?")
#data,addr=sock.recvfrom(1024)
#print("Client is received data : ",data.decode())
@Park-Developer
Park-Developer / udp_server.c
Created January 19, 2022 13:33
Bot udp_server, C
//server.cpp
//header.h
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <netinet/in.h>
# include <sys/socket.h>
# include <arpa/inet.h>
@Park-Developer
Park-Developer / tcp_client.py
Created January 16, 2022 03:57
Python TCP Client
from socket import *
clientSock = socket(AF_INET, SOCK_STREAM)
clientSock.connect(('169.254.42.23', 5100))
print('연결 확인 됐습니다.')
clientSock.send('I am a client'.encode('utf-8'))
@Park-Developer
Park-Developer / tcp_client.c
Created January 12, 2022 11:48
tcp_client using c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#define TCP_PORT 5100
int main(int argc, char **argv)
{
@Park-Developer
Park-Developer / tcp_server.c
Created January 12, 2022 11:47
tcp_server using c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#define TCP_PORT 5100
int main(int argc, char **argv)
{
@Park-Developer
Park-Developer / ir_adc_test.c
Created January 5, 2022 17:35
RPI : IR + ADC test
#include <stdio.h>
#include <wiringPi.h>
#include <pcf8591.h>
#include <math.h>
#define PCF 120
int main (void)
{
int value0 ;
int value1;
@Park-Developer
Park-Developer / cam_resize.py
Created December 27, 2021 16:45
opencv : camera setting
import cv2
cap=cv2.VideoCapture(0) # 카메라 0번 장치 연결
width=cap.get(cv2.CAP_PROP_FRAME_WIDTH) # 프레임 폭
height=cap.get(cv2.CAP_PROP_FRAME_HEIGHT) # 프레임 높이
print("Original Size",width,height)
cap.set(cv2.CAP_PROP_FRAME_WIDTH,320)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT,240)
@Park-Developer
Park-Developer / obj_detect_ex1.py
Created December 26, 2021 08:06
Object Detection ex1
import tensorflow_hub as hub
import cv2
import numpy
import tensorflow as tf
import pandas as pd
# Carregar modelos
detector = hub.load("https://tfhub.dev/tensorflow/efficientdet/lite2/detection/1")
labels = pd.read_csv('labels.csv',sep=';',index_col='ID')
labels = labels['OBJECT (2017 REL.)']