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 / 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 / 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 / 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_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 / 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 / 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 / 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 / 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 / system.c
Created February 6, 2022 06:25
Linux : system()
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/wait.h>
int system(const char *cmd){
pid_t pid;
int status;
if((pid=fork())<0){
@Park-Developer
Park-Developer / read_navi.c
Created February 6, 2022 14:57
bot : read navi info
/*
* main.c
*
* Created on: 2022. 2. 2.
* Author: wonho
*/
#include <stdio.h>
#include "motion.h"
#include <stdlib.h>