Arduino串口的hello world

串口收发的简单栗子

String str = "";

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
}

void loop() {
  while (Serial.available() > 0)
  {
    str += char(Serial.read());
    delay(2);
  }

  if (str.length() > 0)
  {
    delay(200);
    str="R:"+str;
    Serial.println(str);
  }
  
  delay(10);
  str = "";
}

参考资料:
https://www.lxx1.com/3905

竟然没有rabbit最近不是有那兔嘛rabbitmq

第一部分:
sudo lsb_release -a
sudo apt-get update
sudo apt-get install erlang-nox
sudo apt-get install rabbitmq-server

sudo rabbitmqctl status
sudo rabbitmq-plugins enable rabbitmq_management
sudo rabbitmq-plugins enable rabbitmq_mqtt

http://192.168.x.x:15672/

sudo service rabbitmq-server restart
sudo rabbitmqctl list_users
sudo rabbitmqctl add_user admin 123456
sudo rabbitmqctl set_user_tags admin administrator
已经可以登录

第二部分:

参考资料:
https://www.jianshu.com/p/055c0e35c7f6

go的chan

无缓冲区channel

package main

import (
    "fmt"
    "time"
)

func main() {
    ch := make(chan int) // 创建无缓冲channel
    go func() {
        fmt.Println("time sleep 5 second...")
        time.Sleep(5 * time.Second)
        <-ch
    }()
    fmt.Println("即将阻塞...")
    ch <- 1 // 协程将会阻塞,等待数据被读取
    fmt.Println("ch 数据被消费,主协程退出")
}

结果,消费完才能继续

即将阻塞...
time sleep 5 second...
ch 数据被消费,主协程退出

- 阅读剩余部分 -

编译nginx

为啥要编译,希望编译些模块
Ubuntu 20.04 LTS集成的版本nginx version: nginx/1.18.0 (Ubuntu)

wget 'http://nginx.org/download/nginx-1.18.0.tar.gz'
tar -xzvf nginx-1.18.0.tar.gz

wget 'https://github.com/winshining/nginx-http-flv-module/archive/v1.2.8.tar.gz'
tar -xzvf v1.2.8.tar.gz

cd nginx-1.18.0
./configure --add-module=/home/user/nginx/nginx-http-flv-module-1.2.8

提示:error: the HTTP rewrite module requires the PCRE library
sudo apt-get install libpcre3-dev
配置成功,默认位置,可以通过--prefix=/usr/local/nginx配置

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

- 阅读剩余部分 -

Ubuntu安装FFmpeg、flv.js

sudo apt-get install ffmpeg
太慢小时级别,需要换个阿里源分钟级别
ffmpeg -version
ffmpeg version 4.2.4-1ubuntu0.1

关于视频推送的一个项目RtspWebSocket
https://gitee.com/yzfar/RtspWebSocket/tree/master

npm install flv.js
下载素材
https://blog.csdn.net/qq_41672008/article/details/103676839

参考资料:
https://www.cnblogs.com/lonelamb/p/11620906.html