微信小程序App实现小车方向控制

news2024/9/20 22:26:04

目录

概述

1 系统框架结构

1.1 结构介绍

 1.2 硬件模块介绍

1.2.1 蓝牙模块介绍

1.2 .2 模块功能介绍

2 功能实现

2.1 微信小程序APP

2.2 下位机功能

3 功能测试

3.1 小程序UI测试

3.2 小车方向控制


微信小程序和蓝牙模块控制小车运行状态

概述

本文主要介绍使用微信小程序和蓝牙模块设计一个智能小程控制系统,笔者介绍了系统的实现框架结构,还介绍了微信小程序的代码结构和源代码。下位机部分树妖包括:小车方向控制代码,微信小程序与下位机的通信方法。

1 系统框架结构

1.1 结构介绍

1) 使用STM32F103 Timer8 产生4路PWM信号,用于控制电机的转向和调速

2) TIMER7和IO EXIT interrupt 控制光电编码器,用于计算当前电机的转速

3) STM32F103 UART-3接口和蓝牙模块通信

 1.2 硬件模块介绍

1.2.1 蓝牙模块介绍

       HC-08蓝牙串口通信模块是新一代的基于Bluetooth Specification V4.0 BLE 蓝牙协议的数传模块。无线工作频段为 2.4GHz ISM,调制方式是 GFSK。模块最大发射功率为4dBm,接收灵敏度-93dBm,空旷环境下和 手机可以实现 80 米超远距离通信。

        其和MCU之间通过串口通信,软件设计也简单便捷,且不需要考虑蓝牙协议栈问题,非常适合做速成产品。

蓝牙模块与MCU之间连接图:

1.2 .2 模块功能介绍

1)测试传感器

工作原理:

当模块中的槽无遮挡时,接收管导通,DQ输出为低电平

当槽被遮挡时,DQ输出为高电平。

2)码盘

该码盘一周总共有20个孔,则其将一个圆分为20个等分,在测速的时候。只需记录其在1s时间内走过孔的个数,然后通过轮胎的周长与孔等分的关系,就能计算出速度。

 3)轮胎参数

根据参数可得,轮胎的直径为:6.8cm

2 功能实现

2.1 微信小程序APP

1) UI设计

通过4个按钮控制小车的运动方向

2)代码实现:

 在 detail.wxml 文件中实现如下UI代码

<view class="connect_box">
    <text class='connect_device_name'>{{deviceName}}</text>
    <text wx:if="{{connected}}" class="connect_state" catchtap="DisConnectTap">已连接</text>
    <text wx:else class="connect_state" catchtap="DisConnectTap" >未连接</text>
</view>

<view class="block-content">

    <view class="block-item column">
            <view class="item-row slider-box">
                <view class="item-title" >
                  <image class="item-title-icon" src="/images/light_s.png" />温度(℃)
                </view>
                <view class="input-unit"></view>

                <view class="item-title" style="position: relative;  left: 30rpx; ">
                  <image class="item-title-icon" src="/images/light_s.png" />湿度(%)
                </view>
                <view class="input-unit"></view>
            </view>
          
            <view class="item-row">
                <view class="input-value">
                    <input type="digit" value="{{temphtValue}}" disabled="false"/>
                </view>

                <view class="input-value" style="position: relative;  left: -40rpx; ">
                    <input type="digit" value="{{humidityValue}}" disabled="false"/>
                </view>

            </view>
    </view> 

    <view class="block-item column">
            <view class="item-row slider-box">
                <view class="item-title">
                  <image class="item-title-icon" src="/images/light_s.png" />光照(lux)
                </view>
                <view class="input-unit"></view>

                <view class="item-title" style="position: relative;  left: 60rpx; ">
                  <image class="item-title-icon" src="/images/light_s.png" />SR测距(cm)
                </view>
                <view class="input-unit"></view>

            </view>
          
            <view class="item-row">
                <view class="input-value" >
                    <input type="digit" value="{{luxValue}}" disabled="false"/>
                </view>

                <view class="input-value" style="position: relative;  left: -40rpx; ">
                    <input type="digit" value="{{srValue}}" disabled="false"/>
                </view>

            </view>
    </view> 


    <view class="block-item column" style="width: 750rpx; height: 507rpx; display: flex; box-sizing: border-box; left: 0rpx; top: 0rpx; position: relative">
      <button type="primary" bindtap="run_up" plain="true" style="position: relative; left: 3rpx; top: 5rpx; width: 183rpx; height: 357rpx; display: block; box-sizing: border-box">前进</button>
      <button type="primary" bindtap="run_down" plain="true" style="position: relative; left: 0rpx; top: 263rpx; width: 188rpx; height: 326rpx; display: block; box-sizing: border-box">后退</button>
      <button type="primary" bindtap="run_left" plain="true" style="position: relative; left: -247rpx; top: 3rpx; width: 183rpx; height: 361rpx; display: block; box-sizing: border-box">左转</button>
      <button type="primary" bindtap="run_right" plain="true" style="position: relative; left: 256rpx; top: -82rpx; width: 183rpx; height: 343rpx; display: block; box-sizing: border-box">右转</button>
      <button type="primary" bindtap="run_stop" plain="true" style="position: relative; left: 5rpx; top: -173rpx; width: 179rpx; height: 361rpx; display: block; box-sizing: border-box">停止</button>
    </view> 
</view>

逻辑功能实现:

const utils = require('utils.js')
const ble = require('bluetooth.js')
Page({
    /**
     * 页面的初始数据
     */
    data: {
        pageload: false,
        connected: false,
        send_hex: false,
        send_string: true,
        send_string_val: 'Hex',
        recv_string: true,
        recv_string_val: 'Hex',
        recv_value: '',
        send_number: 0,
        recv_number: 0,
        recv_hex: true,
        try_cnt:0,
        rece_string:'',
        deviceArray: []
    },


    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        var that = this; 

        console.log(options);
        this.setData({
            pageload:true,
            connected: false,
            deviceId: options.id,
            try_cnt:0,
            deviceName: options.name
        });

        console.log("detail:  onLoad");
        wx.stopBluetoothDevicesDiscovery({
            success: function (res) {
                console.log('停止搜索设备', res)
            }
        })

        that.closeBLEConnection(that.data.deviceId);
        that.createBLEConnection(that.data.deviceId, that.data.deviceName); 
    }, 

    onHide () {
        var that = this;
        // Do something when hide.
        // 断开连接
        console.log("detail:  onHide");
    },

    onShow:function()
    {      
        // var that = this; 
        // connect bluetooth
        // that.closeBLEConnection(that.data.deviceId);
        // that.createBLEConnection(that.data.deviceId, that.data.deviceName); 
    },

    onUnload() {
        var that = this;

        this.setData({
            pageload:true,
            connected: false,
            try_cnt:0,
        });

        console.log("page:  onUnload  ");
        that.offBLEMonitor();
        that.closeBLEConnection(that.data.deviceId);
        that.closeBluetoothAdapter();

        wx.showToast({
            title: '断开蓝牙',
            icon: 'success',
            duration: 2000
          })  
    },


    DisConnectTap:function()
    {
        var that = this;

        that.setData({
            pageload:true,
            connected: false,
            try_cnt:0,
        });

        ble.openBluetoothAdapter(that.data.deviceId, that.data.deviceName);
        that.createBLEConnection(that.data.deviceId, that.data.deviceName); 
    },



    RecvCleanTap: function () {
        this.setData({
            recv_value: '',
            recv_number: 0
        });
    },  

    /**
     * 创建连接
     * @param {*} deviceId 
     * @param {*} name 
     */
    createBLEConnection(deviceId, name) 
    {
        wx.createBLEConnection({
            deviceId,  
            success: (res) => {
                console.log('createBLEConnection - success: ', res)
                this.getBLEDeviceServices(deviceId)              
            },
            fail: (res) => {
                console.error('createBLEConnection - fail: ', res)
                if(res.errCode == 10006 ){
                    this.createBLEConnection(deviceId, name)
                }
                else{
                    ble.openBluetoothAdapter(deviceId, name)
                    this.createBLEConnection(deviceId, name)
                }

                this.setData({
                    connected: false,
                })               
            } 
        })
    },
        
    getBLEDeviceServices(deviceId) 
    {
        var that = this;
        wx.getBLEDeviceServices({
            deviceId,
            success: (res) => 
            {
                console.log('getBLEDeviceServices - success: ', res)
                for (let i = 0; i < res.services.length; i++) 
                {
                    var ergodic_UUID =res.services[i].uuid;      //取出服务里面的UUID
                    var UUID_slice = ergodic_UUID.slice(4, 8);   //截取4到8位

                    console.log('getBLEDeviceServices, service ID =  ', res.services[i].uuid);
                    if ( res.services[i].isPrimary && (UUID_slice == "FFE0") ) 
                    {
                        that.setData({
                            serviceId: res.services[i].uuid,
                        });
                        break;
                    }
                }

                wx.getConnectedBluetoothDevices({
                    services: res.services,
                    success: (res) => 
                    {                         
                      console.log("getConnectedBluetoothDevices - success:  " +  res)
                    },
                    fail: (res) => {
                        console.error('getConnectedBluetoothDevices - fail: ', res)
                        ble.openBluetoothAdapter(deviceId, that.data.deviceName)
                    }                    
                })

                that.getBLEDeviceCharacteristics(deviceId, that.data.serviceId);
            },
            fail: (res) => {
                console.error('getBLEDeviceServices - fail: ', res)
                // try it again
                ble.openBluetoothAdapter(deviceId, that.data.deviceName)
                that.monitor_connected();
            } 
        });
    },

   getBLEDeviceCharacteristics(deviceId, serviceId) 
   {
        var that = this;
        let falg = false;

        wx.getBLEDeviceCharacteristics({
            deviceId,
            serviceId,
            success: (res) => 
            {
                that.setData({
                    connected: true,
                })                
                console.log('getBLEDeviceCharacteristics success', res.characteristics)
                for (let i = 0; i < res.characteristics.length; i++) 
                {
                    let item = res.characteristics[i]
                     
                    console.log('getBLEDeviceCharacteristics, Characteristics ID =  ', item.uuid)
                    // 该特征值:可读
                    if (item.properties.read) 
                    {
                        wx.readBLECharacteristicValue({
                            deviceId,
                            serviceId,
                            characteristicId: item.uuid,
                        })
                    }

                    // 该特征值:可写
                    if (item.properties.write) 
                    {
                        this.setData({
                            canWrite: true
                        })
                        this._deviceId = deviceId
                        this._serviceId = serviceId
                        this._characteristicId = item.uuid
                        this.writeValue()
                    }

                    if (item.properties.notify || item.properties.indicate) 
                    {
                        that.setData({
                            characteristicId: item.uuid
                        });
                        falg = true;
                        break;
                    }
                }

                
                if( falg )
                {
                    console.debug('getBLEDeviceCharacteristics - deviceId : ', deviceId)
                    console.debug('getBLEDeviceCharacteristics - serviceId : ', serviceId)
                    console.debug('getBLEDeviceCharacteristics - characteristicId: ', that.data.characteristicId)

                    // read device character value 
                    that.readBLECharacteristicValue(deviceId, serviceId, that.data.characteristicId)   
                    that.notifyBLECharacteristicValueChange(deviceId, serviceId, that.data.characteristicId) 
                }
            },
            fail: (res) => {
                console.error('getBLEDeviceCharacteristics -- fail: ', res)
                this.setData({
                    connected: false,
                })

                if (res.errCode === 10006)
                {
                    that.offBLEMonitor();
                    that.createBLEConnection(deviceId, that.data.deviceName); 
                }
            }
        })

   },

   readBLECharacteristicValue(deviceId,serviceId, characteristicId )
   {
        wx.readBLECharacteristicValue({
                // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
                deviceId,
                // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
                serviceId,
                // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
                characteristicId,
                success (res) {
                    console.log('readBLECharacteristicValue:', res.errCode)
                }
         })
   },

   notifyBLECharacteristicValueChange(deviceId,serviceId, characteristicId )
   {
        var that = this;

        wx.notifyBLECharacteristicValueChange({
            state: true,    // enable notify
            deviceId,
            serviceId,
            characteristicId,

            success: (res) => {
                console.info('notifyBLECharacteristicValueChange success: ', res.errMsg)

                // read data here 
                // 操作之前先监听,保证第一时间获取数据
                wx.onBLECharacteristicValueChange(function(res) 
                {
                    that.data.connected = true; 
                    console.info('onBLECharacteristicValueChange', res);
                    console.info(`characteristic ${res.characteristicId} has changed, now is ${res.value}`);

                    var result = res.value;
                    var hex = utils.buf2hex(result);
                    var _hex_ss =  utils.hex2string(hex);

                    console.info("hex: " + hex);
                    console.info("string: " + _hex_ss);
                    that.data.rece_string += _hex_ss;

                    var recv_number_1 = that.data.recv_number + _hex_ss.length / 2;
                    var recv_number = Math.round(recv_number_1);

                    if( that.data.rece_string.includes("log:") && that.data.rece_string.includes(":end")){
                        that.setData({
                            recv_number: recv_number,
                            recv_value: that.data.recv_value + that.data.rece_string,
                        });

                        console.info("string: " + that.data.rece_string);
                        let buff =  that.data.rece_string.split(':')
                        console.log(buff)
                        that.data.rece_string = ''

                        let valueList = buff[1].split(',')
                        that.data.recv_value = "";
                        that.data.recv_number = 0;
                        console.log(valueList)
                        if(valueList.length == 4 ){
                        that.setData({
                            temphtValue: valueList[0],
                            humidityValue: valueList[1],
                            luxValue: valueList[2],
                            srValue: valueList[3],
                        });
                        } 
                    }     
                    that.monitor_connected();
                })                                 
            },

            fail: (res) => {
                console.error('notifyBLECharacteristicValueChange fail: ', res)
                that.monitor_connected();
            }
        })    
   },

   monitor_connected_action()
   {
        var that = this;


        let deviceId = that.data.deviceId;

        wx.onBLEConnectionStateChange(function(res) {
            // 该方法回调中可以用于处理连接意外断开等异常情况
            console.log( "onBLEConnectionStateChange ----- " +  `device ${res.deviceId} state has changed, connected: ${res.connected}`)
            if( res.deviceId == deviceId && res.connected == false )
            {    
                wx.closeBLEConnection({
                    deviceId,
                    success: (res) => {
                        console.debug('detail: closeBLEConnection success', res);  
                        that.offBLEMonitor();
                        that.createBLEConnection(deviceId, that.data.deviceName); 
                    },
                    fail: (res) => {                     
                        console.error('detail: closeBLEConnection fail', res);  
                        if (res.errCode === 10006) {
                            that.offBLEMonitor();
                            that.createBLEConnection(deviceId, that.data.deviceName); 
                        }
                    }
                })

                that.setData({
                    try_cnt: that.data.try_cnt + 1,
                })
            }
            else{
                that.data.try_cnt  = 0;
            }
        })   
   },

   monitor_connected()
   {
        var that = this;

        setTimeout(that.monitor_connected_action, 200);
   },

    writeValue( val ) 
    {
        // 向蓝牙设备发送一个0x00的16进制数据
        let buffer = new ArrayBuffer(1);
        let dataView = new DataView(buffer);

        dataView.setUint8(0, val);

        console.debug('getBLEDeviceCharacteristics - deviceId : ', this._deviceId)
        console.debug('getBLEDeviceCharacteristics - serviceId : ', this._serviceId)
        console.debug('getBLEDeviceCharacteristics - characteristicId: ', this._characteristicId)

        wx.writeBLECharacteristicValue({
            deviceId: this._deviceId,
            serviceId: this._serviceId,
            characteristicId: this._characteristicId,
            value: buffer,
            success: (res) => {
                console.debug('writeBLECharacteristicValue success', res);  
            },
            fail: (res) => {
                console.error(' writeBLECharacteristicValue fail', res);  
                this.setData({
                    connected: false,
                }) 
            }
        })
    },

    closeBluetoothAdapter() 
    {
        wx.closeBluetoothAdapter({           
            success (res) {
              console.log(res)
            }        
        })

        this.setData({
            connected: false,
        }),         
        this._discoveryStarted = false
    },

    closeBLEConnection( deviceId ) 
    {
        wx.closeBLEConnection({
            deviceId,
            success: (res) => {
                console.debug('detail: closeBLEConnection success', res);  
            },
            fail: (res) => {
                console.error('detail: closeBLEConnection fail', res);  
            }
        })

        this.setData({
            connected: false,
            canWrite: false,
        })
    },

    run_up:function()
    {
        var that = this;

        var val = 0x01 ;
        that.writeValue( val );
    }, 
    
    run_down:function()
    {
        var that = this;

        var val = 0x02;      
        that.writeValue( val );   
    },

    run_left:function()
    {
        var that = this;

        var val = 0x03;      
        that.writeValue( val );   

    },

    run_right:function()
    {
        var that = this;

        var val = 0x04;      
        that.writeValue( val );
    },

    run_stop:function()
    {
        var that = this;

        var val = 0x05;
        that.writeValue( val );
    },

    whiteLightValueSliderChange:function(e)
    {
        var that = this;
        // 向蓝牙设备发送一个0x00的16进制数据
        var val = Math.random() * 255 | 0; 
        that.writeValue( val );   
    },

    offBLEMonitor(){
        this.setData({
            connected: false,
        }), 
        wx.offBLEPeripheralConnectionStateChanged();
        wx.offBLEConnectionStateChange();
        wx.offBLECharacteristicValueChange();
        wx.offBLEMTUChange();
    }
})

2.2 下位机功能

代码第29行: 从UART读取一个byte

代码第30行:判断buff接收到的字符串是否越界

代码第38行:设置蓝牙控制命令

#include "bluetooth.h"

#define PROT_FRAME_LEN       16

Stru_BlueCmd stru_BlueCmd;

static uint8_t recv_buf[PROT_FRAME_LEN];
static uint8_t rev_cnt = 0;


void bluetoothCmd_DataRecvByte(uint8_t data )
{
    recv_buf[rev_cnt++] =  data;
    if( rev_cnt >= PROT_FRAME_LEN)
         rev_cnt = 0;
    
    // bluetooth command
    rev_cnt = 0;
    stru_BlueCmd.recStatus +=1;
    if( stru_BlueCmd.recStatus > PROT_FRAME_LEN )
        stru_BlueCmd.recStatus = 0;
    stru_BlueCmd.mcmd = recv_buf[0];
    
}

串口回调函数:

在void UART_RxCpltCallback(UART_HandleTypeDef *huart)函数调用该函数

 

小车运动方向控制函数:

方向控制枚举定义


 电机转动控制函数:

void motor_ctrlAct( uint8_t type, uint16_t speed  )
{
         switch( type )
         {
             case IDLE:
                 break;
             
             case STOP_RUN:
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_1);
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_2);
                
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_3);
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_4);
                break;
             
             case RIGHT_RUN:
                HAL_TIM_SetPWM_Pulse( speed*FACTOR, TIM_CHANNEL_2);
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_1);
                
                HAL_TIM_SetPWM_Pulse( speed, TIM_CHANNEL_3);
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_4);
                break;
             
             case LEFT_RUN:
                HAL_TIM_SetPWM_Pulse( speed*FACTOR, TIM_CHANNEL_1);
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_2);
                
                HAL_TIM_SetPWM_Pulse( speed, TIM_CHANNEL_4);
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_3);
                break;
             
             case UP_RUN:
                HAL_TIM_SetPWM_Pulse( speed, TIM_CHANNEL_1);
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_2);
                
                HAL_TIM_SetPWM_Pulse( speed, TIM_CHANNEL_3);
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_4);
                break;
             
             case DOWN_RUN:
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_1);
                HAL_TIM_SetPWM_Pulse( speed, TIM_CHANNEL_2);
                
                HAL_TIM_SetPWM_Pulse( 0, TIM_CHANNEL_3);
                HAL_TIM_SetPWM_Pulse( speed, TIM_CHANNEL_4);
                break;
         }
}

蓝牙模块控制电机转动功能:

3 功能测试

3.1 小程序UI测试

 1) 手机扫描蓝牙模块信息

手机App上打开小程序,其会自动扫描蓝牙模块的信息

蓝牙模块连接成功,小程序会跳转到主控UI页面

 

 同时,在调试接口上打印出连接成功的信息:

3.2 小车方向控制

通过小程序上的如下四个按钮控制小车的运行方向

 

 系统硬件

调试状态:

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2091932.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

vue.js项目实战案例源码

Vue.js是一个用于构建用户界面的渐进式框架&#xff0c;非常适合开发单页面应用。以下是一些实战案例的源码&#xff0c;可以帮助你更好地理解和使用Vue.js&#xff1a; Vue TodoMVC 简介&#xff1a;这是学习Vue.js的入门级项目&#xff0c;主要实现了一个待办事项列表。源码地…

Python优化算法17——黄金正弦算法(GSA)

科研里面优化算法都用的多&#xff0c;尤其是各种动物园里面的智能仿生优化算法&#xff0c;但是目前都是MATLAB的代码多&#xff0c;python几乎没有什么包&#xff0c;这次把优化算法系列的代码都从底层手写开始。 需要看以前的优化算法文章可以参考&#xff1a;Python优化算…

从 CRX 文件安装 Chrome 扩展程序

在使用嵌入式 Browser 中的扩展程序时&#xff0c;您可能希望将它们打包并分发在应用程序中&#xff0c;并静默安装。 在本教程中&#xff0c;我将演示如何通过编程方式从 CRX 文件中安装扩展程序&#xff0c;保持它们的更新&#xff0c;并使用它们。 此外&#xff0c;我还会…

8.30工作笔记

要做的事情&#xff1a; 1 测试剩下的三个因子&#xff1a;coppock 潮汐因子 云开雾散 2 整理需要时间序列的因子 以及截面因子 3 灾后重建多了一列&#xff0c;灾后重建’所有值都是nan&#xff0c;这里不仅是灾后重建&#xff0c;所有的都要改 4 coppock 潮汐因子 云开雾散在…

排列数+时间戳+逆元取模

前言&#xff1a;这个题目是真的难&#xff0c;不会做&#xff0c;看了题解才发现是咋回事 题目地址 最主要的就是为啥是除以3&#xff0c;c之前需要完成a 和 b&#xff0c;d 和 e 对我们的答案没有影响&#xff0c;所以我们要除以 A(3,3) ,但是 a 和 b 的排列没有要求&#xf…

Sinc Function介绍

1、定义 Sinc函数全称&#xff1a;sine cardinal&#xff0c;也称作是sampling function&#xff08;采样函数&#xff09;。 2、分类 &#xff08;1&#xff09;归一化sinc函数&#xff1a; 这种定义在信号处理中被广泛采用&#xff0c;其中 x 是一个无量纲的变量&#xff0c;…

基于YOLO的车牌检测识别(YOLO+Transformer)

概述&#xff1a; 基于深度学习的车牌识别&#xff0c;其中&#xff0c;车辆检测网络直接使用YOLO侦测。而后&#xff0c;才是使用网络侦测车牌与识别车牌号。 车牌的侦测网络&#xff0c;采用的是resnet18&#xff0c;网络输出检测边框的仿射变换矩阵&#xff0c;可检测任意形…

同城小程序怎么做 同城小程序系统开发制作方案

很多同城创业的老板们想要做一个同城小程序但是不知道怎么做&#xff0c;本次瀚林就为大家详细介绍一下做同城小程序系统开发制作方法&#xff0c;给大家做个参考。 目前同城类型的小程序系统市面上比较常见的有&#xff1a;同城配送、鲜花订花、同城上门服务、同城跑腿、同城便…

中仕公考怎么样?事业编考试怎么备考?

事业编考试备考可以大致分为三个阶段&#xff0c;按照不同阶段根据自身的学习情况制定不同的学习计划即可。 ①基础阶段 有备考经验的考生可以忽略这一步&#xff0c;刚开始先打好基础很重要&#xff0c;根据课程和教材理解知识点&#xff0c;按照模块学习&#xff0c;对考试…

cnocr 安装

打开终端 如果不会打开终端 -> 终端打开输入 pip install cnocr 执行中途可能报错 去这里下载工具&#xff1a;c构建工具下载完打开&#xff0c;勾选这个 然后点安装安装完回到第2步重新执行

docker镜像所使用到的COW写时复制技术是什么

copy on write 简单来说&#xff0c;所有的读操作都是指向一份内存地址&#xff0c;共享这些数据&#xff0c;节省内存空间。 如果有进程要对数据进行写操作&#xff0c;系统会检测到这个行为&#xff0c;将数据复制一份出来&#xff0c;给这个进程进行写操作。其他进程继续…

5.3二叉树——二叉树链式结构实现

本篇博客梳理二叉树链式结构 明确&#xff1a;二叉树是递归定义的 递归的本质&#xff1a;当前问题子问题&#xff0c;返回条件是最小规模的子问题 一、二叉树的遍历 1&#xff0e;前序、中序与后序遍历 &#xff08;1&#xff09;前序&#xff1a;根->左子树->右子树…

全球知名度最高的华人颜廷利:世界公认十大思想家哲学家

全球知名度最高的华人颜廷利&#xff1a;世界公认十大思想家哲学家 在汉语这一中国优秀传统文化的瑰宝中&#xff0c;“色”与“舍”这两个字的发音分别被解读为“思恶”和“识恶”&#xff0c;揭示了一种深奥的文化现象。这种现象的根源&#xff0c;实则来自于我们的感官——眼…

linux上查找某应用所在的绝对路径

linux上查找某应用所在的绝对路径 1、已知应用名称 找到应用的进程号 例&#xff1a;查找nginx的进程号 ps -ef | grep nginx 或者 ps -aux | grep nginx 2、通过端口号找进程号 lsof -i:80 3、通过进程号找到所在目录&#xff0c;Linux在启动一个进程时,系统会在/proc目…

力扣刷题(3)

整数反转 整数反转-力扣 思路&#xff1a; 利用%和/不断循环取待反转整数的最后一位&#xff0c;注意判断是否超出范围。 int reverse(int x){int y0;while(x){if(y > INT_MAX/10 || y < INT_MIN/10)return 0;int tmpx%10;yy*10tmp;x/10;}return y; }字符串转换整数 …

多线程篇(基本认识 - 锁优化)(持续更新迭代)

目录 一、前言 二、阿里开发手册 三、synchronized 锁优化的背景 四、Synchronized的性能变化 1. Java5之前&#xff1a;用户态和内核态之间的切换 2. java6开始&#xff1a;优化Synchronized 五、锁升级 1. 无锁 2. 偏向锁 2.1. 前言 2.2. 什么是偏向锁 2.3. 偏向…

知识产权案件中的消费者问卷调查证据

在知识产权案件中&#xff0c;消费者问卷调查可以作为一种重要的证据形式。通过调查消费者的认知、态度、行为和观点&#xff0c;消费者问卷调查可以提供以下方面的证据支持&#xff1a; 1、商标或产品混淆&#xff1a;消费者问卷调查可以确定消费者对于涉及知识产权的商标或产…

《python语言程序设计》第8章第9题将二进制数作为字符串转换十六进制print和return的区别

在这里我发现了return和print的区别 def binary_to_hex(binary_value):len_text len(binary_value)for i in range(0, len_text, 4):#能把二进制分成四组进行打印print(binary_value[0 i:4 i])#只能运行将前4个数分成一组return binary_value[0 i:4 i]a binary_to_hex(&q…

HarmonyOS--AGC(认证服务/云函数/云存储/云数据库)

HarmonyOS–AGC(认证服务/云函数/云存储/云数据库) 文章目录 一、注册华为账号开通认证服务二、添加项目&#xff1a;*包名要与项目的包名保持一致三、获取需要的文件四、创建项目&#xff1a;*包名要与项目的包名保持一致五、添加json文件六、加入请求权限七、加入依赖八、修改…

Openai api via azure error: NotFoundError: 404 Resource not found

题意&#xff1a;"OpenAI API通过Azure出错&#xff1a;NotFoundError: 404 找不到资源" 问题背景&#xff1a; thanks to the university account my team and I were able to get openai credits through microsoft azure. The problem is that now, trying to us…