---
# System prepended metadata

title: '[20190616 - Raspberry Pi](https://hackmd.io/s/SkgLJCCnV)'
tags: [tcfst]

---

# [20190616 - Raspberry Pi](https://hackmd.io/s/SkgLJCCnV)
###### tags: `tcfst`

## Author
 - Yuan < e61983@gmail.com >
 - Wei < demon0303loki@gmail.com >
 - Jia-Hao,Hsu < jhs.8901.3737@gmail.com >

## License
![cc by-nc-sa](https://licensebuttons.net/l/by-nc-sa/3.0/88x31.png)

## OpenCV & Camara

- [Pi Facerec Box][github-pi-facerec-box]

    {%youtube CTP9rpgabYI %}

## Web-Cam

- [mjpg-streamer][github-mjpg-streamer]

    {%youtube e7ufygg_FsU%}

## Google App Srcipt

- [Google Apps Script][google-apps-script]
    {%youtube SfRXsiuzbCI%}
    
### Arduino Demo

{%youtube mpwSAFwlL_0 %}
    
#### Reference
- [用 Google Apps Script 操作試算表][gas-sheet]

## Line Bot

#### Reference

- [Building Line bot][building-line-bot]
- [Line Messaging API][line-message-api]

  {%youtube WAZCRjkwn8w %}
  
## Socket
- [Python socket][python-socket]

### UDP


### TCP

#### Using Thread

### Multicast

## Thread

### Header File
```c=
#include <pthread.h>
```

### Example
```c=
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void *print_message_function( void *ptr );

main()
{
     pthread_t thread1, thread2;
     char *message1 = "Thread 1";
     char *message2 = "Thread 2";
     int  iret1, iret2;

    /* Create independent threads each of which will execute function */

     iret1 = pthread_create( &thread1, NULL, print_message_function, (void*) message1);
     iret2 = pthread_create( &thread2, NULL, print_message_function, (void*) message2);

     /* Wait till threads are complete before main continues. Unless we  */
     /* wait we run the risk of executing an exit which will terminate   */
     /* the process and all threads before the threads have completed.   */

     pthread_join( thread1, NULL);
     pthread_join( thread2, NULL); 

     printf("Thread 1 returns: %d\n",iret1);
     printf("Thread 2 returns: %d\n",iret2);
     exit(0);
}

void *print_message_function( void *ptr )
{
     char *message;
     message = (char *) ptr;
     printf("%s \n", message);
}
```

## Process and Synchronize

### Reference:

- [行程間的通訊與同步P.5][ch3-process_and_sync]
- [Semaphore][semaphore]
- [Mutex][mutex]

## 梗區

## 場外
>有訊息 mail 給我
>merlin@mail.vnu.edu.tw
>[name=李文昌講師]

[github-pi-facerec-box]:
https://github.com/tdicola/pi-facerec-box

[github-mjpg-streamer]:
https://github.com/jacksonliam/mjpg-streamer

[google-apps-script]:
https://developers.google.com/apps-script/

[gas-sheet]:
https://www.wfublog.com/2017/01/google-apps-script-spreadsheet-write-data.html

[building-line-bot]:
https://developers.line.biz/en/docs/messaging-api/building-bot/

[line-message-api]:
https://developers.line.biz/en/docs/messaging-api/using-quick-reply/

[python-socket]:
https://docs.python.org/3/library/socket.html

[semaphore]:
https://blog.csdn.net/ljianhui/article/details/10813469

[mutex]:
https://blog.csdn.net/ljianhui/article/details/10875883

[ch3-process_and_sync]:
https://wenku.baidu.com/view/a3b16779168884868762d6ac.html