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 / child_template.html
Created March 12, 2022 23:33
AJAX with Python Flask
{% extends 'base.html' %}
{% block title %}Setting{% endblock %}
{% block head %}
{{ super() }}
<!--<style type="text/css">
.important { color: #336699; }
</style>
-->
{% endblock %}
@Park-Developer
Park-Developer / tcp_client.py
Created March 2, 2022 05:10
TCP Test : Python Client - C Server
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("WIFI ADDRESS", 5101))
while(True):
# 접속할 서버의 ip주소와 포트번호를 입력. sock.send('Hello'.encode())
inputdata=input()
sock.send(inputdata.encode()) # 내가 전송할 데이터를 보냄.
data=sock.recv(1024)
print(data.decode('utf-8'))
@Park-Developer
Park-Developer / pid_control.c
Created February 25, 2022 15:35
PID Control
#include <stm32f4xx.h>
//ALL the variables have been defined here
static int i = 0;int bit =0;int speed =0;int res =0;
// refernce and pid related constants
int ref_speed = 120;float duty =0;int iteration_time =0;
//errors variables
@Park-Developer
Park-Developer / excution_time.c
Created February 20, 2022 11:53
C ms time stamp
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
int main() {
struct timeval tv;
double begin, end;
// 시작하는 시간 받아오기
gettimeofday(&tv, NULL);
@Park-Developer
Park-Developer / flask_rt_text.py
Created February 17, 2022 15:25
flask realtime text update
from flask import Flask, render_template_string
import time
app = Flask(__name__)
@app.route('/')
def index():
return render_template_string('''<p>This is the current value: <span id="latest_value"></span></p>
<script>
@Park-Developer
Park-Developer / serial.py
Created February 13, 2022 17:41
Python : Serial
import serial
from time import sleep
ser = serial.Serial ("/dev/ttyACM0", 9600) #Open port with baud rate
while True:
received_data = ser.read() #read serial port
sleep(0.03)
data_left = ser.inWaiting() #check for remaining byte
received_data += ser.read(data_left)
@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>
@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 / 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;