2022년 6월 30일 목요일

string Add

 #include<stdio.h>

#include<string.h>

int main() {

    char str[1024] = "Hello Worl";

    char c[2] = " d";

    char d[10] = " x ";

    char e[10] = " aaaab ";

    strcat(str, c);

    strcat(str, d);

    strcat(str, e);

    printf("%s\n", str); // Hello World

}

2022년 6월 24일 금요일

linux C time

#include <stdio.h>

#include <time.h>

int main(void)

{  

 time_t time_val;

  struct tm * pTime;

  time(&time_val);

  pTime = gmtime(&time_val);

  pTime = localtime(&time_val);

  printf("%d/%d/%d %d:%d:%d\n", pTime->tm_year + 1900, pTime->tm_mon + 1, pTime->tm_mday + 1,

  pTime->tm_hour, pTime->tm_min, pTime->tm_sec);

}

2022년 6월 20일 월요일

raspberry pi influxdb and influxdb-client install

apt-get install influxdb

influxd    Execution


apt-get install influxdb-client 

influx  Execution (client Execution)


apt-get remove pakagename (ex apt-get remove mariadb-server)

2022년 6월 11일 토요일

button debounce

#define GPIO_IN_1 PIN7_bp // PortJ

u16 state = 0;

bool debounce() {

    state = (state<<1) | (PORTJ.IN & (1<<GPIO_IN_1)) | 0xfe00;

    return (state == 0xff00);

    }


int main(void)

{

    while(1)

    {

          if (debounce())

{

//PORTJ.OUT =  0b00100000;

if(ADC_Arc_Hit == 0)

{

ADC_Arc_Hit = 1; 

}

else

{

ADC_Arc_Hit = 0;

}

}

}

2022년 6월 8일 수요일