Android Studio 实现登录注册-源代码 (连接MySql数据库)

2023-05-16

Android Studio 实现登录注册-源代码 (连接MySql数据库)

Android Studio 实现登录注册-源代码 二(Servlet + 连接MySql数据库)

[Android Studio 实现登录注册-源代码 三(Servlet + 连接MySql数据库)实现学生信息的查询 (JSON通信)]

Android Studio 实现实现学生信息的增删改查 -源代码 四(Servlet + 连接MySql数据库)

在这里插入图片描述
在这里插入图片描述

一、创建工程

1、创建一个空白工程

在这里插入图片描述

2、随便起一个名称

在这里插入图片描述

3、设置网络连接权限

在这里插入图片描述

     <uses-permission android:name="android.permission.INTERNET" />

二、引入Mysql驱动包

1、切换到普通Java工程

在这里插入图片描述

2、在libs当中引入MySQL的jar包

将mysql的驱动包复制到libs当中
在这里插入图片描述
在这里插入图片描述

三、编写数据库和dao以及JDBC相关代码

1、在数据库当中创建表

在这里插入图片描述

SQL语句

/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 50562
Source Host           : localhost:3306
Source Database       : test

Target Server Type    : MYSQL
Target Server Version : 50562
File Encoding         : 65001

Date: 2021-05-10 17:28:36
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for `student`
-- ----------------------------
DROP TABLE IF EXISTS `student`;
CREATE TABLE `student` (
  `sid` int(11) NOT NULL AUTO_INCREMENT,
  `sname` varchar(255) NOT NULL,
  `sage` int(11) NOT NULL,
  `address` varchar(255) NOT NULL,
  PRIMARY KEY (`sid`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of student
-- ----------------------------
INSERT INTO `student` VALUES ('1', 'andi', '21', '21212');
INSERT INTO `student` VALUES ('2', 'a', '2121', '2121');

-- ----------------------------
-- Table structure for `users`
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `uid` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `age` int(255) NOT NULL,
  `phone` longblob NOT NULL,
  PRIMARY KEY (`uid`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES ('2', '123', 'HBV环保局', '123', '33', 0x3133333333333333333333);
INSERT INTO `users` VALUES ('3', '1233', '反复的', '1233', '12', 0x3132333333333333333333);
INSERT INTO `users` VALUES ('4', '1244', '第三代', '1244', '12', 0x3133333333333333333333);
INSERT INTO `users` VALUES ('5', '1255', 'SAS', '1255', '33', 0x3133333333333333333333);

2、在Android Studio当中创建JDBCUtils类

切换会Android视图
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
注意链接数据库的地址是:jdbc:mysql://10.0.2.2:3306/test

package com.example.myapplication.utils;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JDBCUtils {



    static {

        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

    }

    public static Connection getConn() {
        Connection  conn = null;
        try {
            conn= DriverManager.getConnection("jdbc:mysql://10.0.2.2:3306/test","root","root");
        }catch (Exception exception){
            exception.printStackTrace();
        }
        return conn;
    }

    public static void close(Connection conn){
        try {
            conn.close();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }

}

3、创建User实体类

在这里插入图片描述

package com.example.myapplication.entity;

public class User {

    private int id;
    private String name;
    private String username;
    private String password;
    private int age;
    private String phone;


    public User() {
    }

    public User(int id, String name, String username, String password, int age, String phone) {
        this.id = id;
        this.name = name;
        this.username = username;
        this.password = password;
        this.age = age;
        this.phone = phone;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }
}

4、创建dao层和UserDao

在这里插入图片描述

package com.example.myapplication.dao;

import com.example.myapplication.entity.User;
import com.example.myapplication.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class UserDao {


    public boolean login(String name,String password){

        String sql = "select * from users where name = ? and password = ?";

        Connection  con = JDBCUtils.getConn();

        try {
            PreparedStatement pst=con.prepareStatement(sql);

            pst.setString(1,name);
            pst.setString(2,password);

            if(pst.executeQuery().next()){

                return true;

            }

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            JDBCUtils.close(con);
        }

        return false;
    }

    public boolean register(User user){

        String sql = "insert into users(name,username,password,age,phone) values (?,?,?,?,?)";

        Connection  con = JDBCUtils.getConn();

        try {
            PreparedStatement pst=con.prepareStatement(sql);

            pst.setString(1,user.getName());
            pst.setString(2,user.getUsername());
            pst.setString(3,user.getPassword());
            pst.setInt(4,user.getAge());
            pst.setString(5,user.getPhone());

            int value = pst.executeUpdate();

            if(value>0){
                return true;
            }


        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            JDBCUtils.close(con);
        }
        return false;
    }

    public User findUser(String name){

        String sql = "select * from users where name = ?";

        Connection  con = JDBCUtils.getConn();
        User user = null;
        try {
            PreparedStatement pst=con.prepareStatement(sql);

            pst.setString(1,name);

            ResultSet rs = pst.executeQuery();

            while (rs.next()){

               int id = rs.getInt(0);
               String namedb = rs.getString(1);
               String username = rs.getString(2);
               String passworddb  = rs.getString(3);
               int age = rs.getInt(4);
                String phone = rs.getString(5);
               user = new User(id,namedb,username,passworddb,age,phone);
            }

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            JDBCUtils.close(con);
        }

        return user;
    }


}

四、编写页面和Activity相关代码

1、编写登录页面

在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:layout_editor_absoluteX="219dp"
        tools:layout_editor_absoluteY="207dp"
        android:padding="50dp"

        >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">


            <TextView
                android:id="@+id/textView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:textSize="15sp"
                android:text="账号:" />

            <EditText
                android:id="@+id/name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="textPersonName"
                android:text="" />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">


            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:textSize="15sp"
                android:text="密码:"

                />

            <EditText
                android:id="@+id/password"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="textPersonName"
               />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">



        </LinearLayout>

        <Button
            android:layout_marginTop="50dp"
            android:id="@+id/button2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="登录"
            android:onClick="login"
            />

        <Button
            android:id="@+id/button3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:onClick="reg"
            android:text="注册" />
    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

效果
在这里插入图片描述

2、编写注册页面代码

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".RegisterActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:layout_editor_absoluteX="219dp"
        tools:layout_editor_absoluteY="207dp"
        android:padding="50dp"

        >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">


            <TextView
                android:id="@+id/textView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:textSize="15sp"
                android:text="账号:" />

            <EditText
                android:id="@+id/name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="textPersonName"
                 />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:textSize="15sp"
                android:text="昵称:" />

            <EditText
                android:id="@+id/username"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="textPersonName"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">


            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"

                android:textSize="15sp"
                android:text="密码:"

                />

            <EditText
                android:id="@+id/password"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="textPassword"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"

                android:textSize="15sp"
                android:text="手机:"

                />

            <EditText
                android:id="@+id/phone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="phone"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"

                android:textSize="15sp"
                android:text="年龄:"

                />

            <EditText
                android:id="@+id/age"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="number"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">



        </LinearLayout>

        <Button
            android:layout_marginTop="50dp"
            android:id="@+id/button2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="注册"
            android:onClick="register"
            />

        <Button
            android:id="@+id/button3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="重置" />
    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

3、完善MainActivity

在这里插入图片描述

package com.example.application01;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.example.application01.dao.UserDao;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void reg(View view){

        startActivity(new Intent(getApplicationContext(),RegisterActivity.class));

    }


    public void login(View view){

        EditText EditTextname = (EditText)findViewById(R.id.name);
        EditText EditTextpassword = (EditText)findViewById(R.id.password);

        new Thread(){
            @Override
            public void run() {

                UserDao userDao = new UserDao();

                boolean aa = userDao.login(EditTextname.getText().toString(),EditTextpassword.getText().toString());
                int msg = 0;
                if(aa){
                    msg = 1;
                }

                hand1.sendEmptyMessage(msg);


            }
        }.start();


    }
    final Handler hand1 = new Handler()
    {
        @Override
        public void handleMessage(Message msg) {

            if(msg.what == 1)
            {
                Toast.makeText(getApplicationContext(),"登录成功",Toast.LENGTH_LONG).show();

            }
            else
            {
                Toast.makeText(getApplicationContext(),"登录失败",Toast.LENGTH_LONG).show();
            }
        }
    };

}

4、完善RegisterActivity

在这里插入图片描述

package com.example.application01;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.example.application01.dao.UserDao;
import com.example.application01.entity.User;

public class RegisterActivity extends AppCompatActivity {
    EditText name = null;
    EditText username = null;
    EditText password = null;
    EditText phone = null;
    EditText age = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);

         name = findViewById(R.id.name);
         username = findViewById(R.id.username);
         password = findViewById(R.id.password);
         phone = findViewById(R.id.phone);
         age = findViewById(R.id.age);
    }


    public void register(View view){



        String cname = name.getText().toString();
        String cusername = username.getText().toString();
        String cpassword = password.getText().toString();

        System.out.println(phone.getText().toString());

        String cphone = phone.getText().toString();
        int cgae = Integer.parseInt(age.getText().toString());

        if(cname.length() < 2 || cusername.length() < 2 || cpassword.length() < 2 ){
            Toast.makeText(getApplicationContext(),"输入信息不符合要求请重新输入",Toast.LENGTH_LONG).show();
            return;

        }


        User user = new User();

        user.setName(cname);
        user.setUsername(cusername);
        user.setPassword(cpassword);
        user.setAge(cgae);
        user.setPhone(cphone);

        new Thread(){
            @Override
            public void run() {

                int msg = 0;

                UserDao userDao = new UserDao();

                User uu = userDao.findUser(user.getName());

                if(uu != null){
                    msg = 1;
                }

                boolean flag = userDao.register(user);
                if(flag){
                    msg = 2;
                }
                hand.sendEmptyMessage(msg);

            }
        }.start();


    }
    final Handler hand = new Handler()
    {
        @Override
        public void handleMessage(Message msg) {
            if(msg.what == 0)
            {
                Toast.makeText(getApplicationContext(),"注册失败",Toast.LENGTH_LONG).show();

            }
            if(msg.what == 1)
            {
                Toast.makeText(getApplicationContext(),"该账号已经存在,请换一个账号",Toast.LENGTH_LONG).show();

            }
            if(msg.what == 2)
            {
                //startActivity(new Intent(getApplication(),MainActivity.class));

                Intent intent = new Intent();
                //将想要传递的数据用putExtra封装在intent中
                intent.putExtra("a","註冊");
                setResult(RESULT_CANCELED,intent);
                finish();
            }

        }
    };
}

五、运行测试效果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

Android Studio 实现登录注册-源代码 (连接MySql数据库)

Android Studio 实现登录注册-源代码 二(Servlet + 连接MySql数据库)

[Android Studio 实现登录注册-源代码 三(Servlet + 连接MySql数据库)实现学生信息的查询 (JSON通信)]

Android Studio 实现实现学生信息的增删改查 -源代码 四(Servlet + 连接MySql数据库)

先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android Studio 实现登录注册-源代码 (连接MySql数据库) 的相关文章

  • Prometheus环境搭建

    实验环境 xff1a 准备三台虚拟机 xff0c 本文用Centos7为例 xff1b 我这里所使用的的虚拟机地址分别为 xff1a 主机名 xff1a IP prometheus weme 192 168 10 63 agent weme
  • 无人机飞控系统硬件设计

    目录 一 飞行控制系统简介 1 飞控系统功能分析 2 飞控系统基本原理 3 飞控系统的组成部分 3 1 地面部分 3 2 中央处理器 3 3 传感器模块 3 4 传输定位模块 二 飞控系统硬件平台设计 一 飞行控制系统简介 1 飞控系统功能
  • Ubuntu20.04中怎么更换源都不行install或者update始终报错,解决方案

    更换源后安装或者更新依旧报错 xff0c 试试下面两种方法 xff0c 亲测可行 方法一 xff1a 静态ip改成动态ip 如果ip是静态改成动态ip后 xff0c 重新在试试apt update 1 vi etc netplan 00 i
  • AlphaGo 引发的中国象棋之路

    笔者是一位多年的象棋爱好者 xff0c 早在2005 xff0c 中国象棋有款软件奇兵1 04 xff0c 当时打败特级大师于幼华 xff0c 又打败了柳大华 xff0c 后期软件和计算机硬件的发展 xff0c 象棋软件又有了质的飞越 xf
  • linux驱动IO模型

    1 非阻塞 当应用层读取驱动中的数据时 xff0c 无论数据是否准备号 xff0c 都需要立即返回 open 34 dev mycdev 34 O RDWR O NOBLOCK 非阻塞方式打开 默认打开方式为阻塞方式打开 O NOBLIOC
  • ROS学习(一)工作空间,功能包,节点

    本文主要介绍建立一个功能包 xff0c 一个publisher结点 xff0c 实现话题的发布 一工作空间 1创建所需的文件夹 mkdir ros cd ros mkdir src 2工作空间的初始化 cd src catkin init
  • NVIDIA Jetson Xavier NX搭建pytorch gpu环境(超详细)

    NVIDIA Jetson Xavier NX开发套件在搭建tensorflow gpu环境时可以使用指令直接安装或者官网下载whl文件安装 作者在安装pytorch环境时总是安装不上gpu版本 报错 AssertionError Torc
  • uCOS-iii学习笔记(11)——任务信号量和任务消息队列

    理解 xff1a 任务信号量 任务消息队列是跟随任务创建而来的 xff0c 不需要额外创建 xff0c 并且他和多值信号量 消息队列有一些不同 xff0c 多值信号量他们是建立于1对多得关系 xff0c 而我们的任务信号量还有任务消息队列是
  • C语言当中什么情况下形参可以改变实参详细实例及解释

    在 C 语言中 xff0c 形参可以改变实参的值的情况与 C 43 43 类似 xff0c 也有传递指针和传递引用两种方式 传递指针 当我们传递一个指针作为函数的形参时 xff0c 函数内部同样可以通过这个指针来改变指向的实参的值 这是因为
  • git仓库与vscode关联

    git仓库与vscode关联 git安装完后 xff0c 会提示输入用户信息 a 设置用户名 xff1a git config global user name 39 你再github上注册的用户名 39 b 设置用户邮箱 xff1a gi
  • python修改全局变量

    span class token comment 全局变量 span num span class token operator 61 span span class token number 10 span span class toke
  • python函数不能修改全局变量

    span class token comment 全局变量 span num span class token operator 61 span span class token number 10 span span class toke
  • FreeRTOS笔记(六)互斥量mutex

    概念 互斥量是二进制信号量的一个变种 xff0c 开启互斥量需要在头文件FreeRTOSConfig h 设置configUSE MUTEXES 为1 互斥量和信号量的主要区别如下 互斥量用于保护资源时必须要被返还 信号量用于数据同步时不需
  • 完爆面试官!spring可能带来的一个深坑

    4步套路 xff0c 解决动态规划问题 1 确定问题状态 提炼最后一步的问题转化 2 转移方程 xff0c 把问题方程化 3 按照实际逻辑设置初始条件和边界情况 4 确定计算顺序并求解 结合实例感受下 xff1a 你有三种硬币 xff0c
  • 树莓派Raspberry Pi 2B在Kali上使用TightVNCServer灰屏

    1 将 root vnc xstartup改为 span class token shebang important bin sh span unset SESSION MANAGER unset DBUS SESSION BUS ADDR
  • STM32——UCOSIII 简介

    目录 UCOSIII简介 UCOSIII中的任务 组成 任务堆栈 任务控制块 任务函数 任务函数模板 UCOSIII系统任务 组成 空闲任务 时钟节拍任务 统计任务 定时任务 中断服务管理任务 UCOSIII任务状态 组成及状态概念 UCO
  • ARM —— 寄存器的封装

    目录 SFR 直接一对一封装 结构体封装寄存器 SFR 全称 xff1a 特殊功能寄存器 xff08 Special Function Register xff09 作用 xff1a 用于 控制片内外设 xff0c 存放 相应功能部件的 控
  • Ubuntu给Pix2.4.8刷Ardupilot固件

    全文基于waf编译器使用 waf命令 xff0c APM官网对于waf的使用描述 xff1a https github com ArduPilot ardupilot blob master BUILD md 前提 xff1a 已经在ubu
  • 程序猿面试经验总结(经验篇)

    开篇序 金九银十大家都知道吧 xff0c 的确九十月份都是跳槽旺季与招聘旺季 xff0c 无论是找工作的 招聘的单位都是特别特别的多 xff0c 多的你有时候看都看不过来 xff0c 以至于让你有时候很难选择 xff0c 其实选择对应自己的
  • STM32 HAL库和标准库的原理区别

    STM32 HAL库和标准库的原理区别 HAL简介 HAL库 xff0c HAL是Hardware Abstraction Layer的缩写 xff0c 中文名称是 xff1a 硬件抽象层 xff0c 是st公司为了更方便地进行stm32之

随机推荐

  • 【超详细~】js的三大定时器:setTimeout、setInterval、requestAnimationFrame

    setTimeout xff08 表达式 xff0c 时间 xff09 61 gt 是指延迟指定时间后才调用函数 xff0c 调用次数仅一次 xff1b setInterval xff08 表达式 xff0c 时间 xff09 61 gt
  • FreeRTOS的学习(一)——实时操作系统和多任务的介绍

    目录 1 初识FreeRTOS 2 FreeRTOS 任务的状态 3 FreeRTOS 的任务 任务的创建和删除 1 xTaskCreate xff1a 使用静态的方法创建一个任务 2 xTaskCreateStatic xff1a 使用静
  • FreeRTOS的学习(四)—— 信号量之间的优先级翻转问题和互斥信号量

    目录 优先级翻转现象 什么是优先级翻转 互斥信号量 1 互斥信号量简介 2 创建互斥信号量 1 函数 xSemaphoreCreateMutex 2 函数 xSemaphoreCreateMutexStatic 3 释放互斥信号量 4 获取
  • STC15单片机 固定翼无人机/航模 飞控程序

    stc15单片机 固定翼无人机 飞控程序 硬件 stcf2k60s22 4g无线通信模块nrf24l01mg90s数字舵机摇杆无刷电机电调 用到的单片机资源 pwmad转换 程序结构 利用ADC转换读取摇杆值将摇杆数值转换为16进制通过2
  • ESP8266 WIFI 模块使用说明

    ESP8266是ai thinker公司推出的一款无线WIFI模块 xff0c 可以通过配置 xff0c 和单片机上的串口进行通信 xff0c 利用WIFI传输数据 1 AT指令简介 同许多通信模块一样 xff0c 我们需要对WIFI模块利
  • Ubuntu18更新软件源、安装python3.8和安装pip

    目录 一 更新软件源二 安装python3 8三 安装pip 一 更新软件源 1 xff09 首先 xff0c 打开sources list文件 sudo vim etc apt sources list 若没有vim xff0c 则需要进
  • Python 迭代器 与 异常处理

    文章目录 迭代介绍可迭代对象迭代器对象迭代器对象取值 方法的简写for循环内部原理异常处理异常的分类异常的类型异常的处理try except 语句try except else 语句try except finally 语句try exce
  • linux系统进程 exec函数族的使用(fork之后)

    1 2 exec 函数族 头文件 unistd h 3 exec 函数可用在fork 函数之后 xff0c 直接执行一个程序而省略子进程复制父进程的资源 4 调用exec不会创建一个新的pid 5 6 path xff1a 可执行文件的路径
  • Collecting package metadata (current_repodata.json): failed的问题解决

    解决方法 1 删除 condarc文件 2 关闭VPN 3 https的锅 xff0c 详情看下面的博客 环境配置 Collecting package metadata current repodata json failed的问题解决
  • 作业1:CAN数据库配置(DBC)

    目录 一 首先如何创建dbc文件 二 创建 三 创建节点NODE 一 其它 xff08 共1题 xff0c 100分 xff09 1 其它 使用vector candb editor软件 xff0c 按给定的信号矩阵配置CAN xff0c
  • Visual Studio 2022 C++下载及配置

    下载地址 xff1a https visualstudio microsoft com zh hans vs 之后点击右下角的安装 xff1b 如果下载速度一直为0 xff0c 那么解决方法为 xff1a 修改电脑的DNS服务器地址为8 8
  • app测试和web测试的区别

    1 功能方面 xff1a 在流程和功能测试上是没有区别的 xff0c 系统测试和一些细节可能会不一样 那么我们就要先来了解 xff0c web和app的区别 xff1a web项目 xff0c 一般都是b s架构 xff0c 基于浏览器的
  • Java网络编程实现

    前言 计算机网路实现了多个网络终端的互联 xff0c 彼此之间能够进行数据交流 而网络应用程序就是在已连接的不同终端设备上运行的程序 xff0c 这些网络程序相互之间可以进行数据交互 网络程序的数据交互则依赖于TCP IP协议 xff0c
  • java对象转JSONObject、JSONObject转java对象及String转JSONObject

    JSONObject jo 61 JSONObject JSONObject toJSON javaBean Student stu 61 JSONObject parseObject jo Student class JSONObject
  • redis设置密码

    设置密码有两种方式 1 命令行设置密码 运行cmd切换到redis根目录 xff0c 先启动服务端 gt redis server exe 另开一个cmd切换到redis根目录 xff0c 启动客户端 gt redis cli exe h
  • 【Java】Java四舍五入保留1位小数、2位小数

    方法一 xff1a 使用字符串格式化实现四舍五入 支持float和double类型 double data 61 3 02 利用字符串格式化的方式实现四舍五入 保留1位小数 String result 61 String format 34
  • ROS: [xxx.launch] is neither a launch file in package

    在ROS执行launch文件的过程中 xff0c 我经常碰见这个问题 xff0c 比如最近在安装ARBOTIX仿真器的时候 sudo apt get install ros indigo arbotix rospack profile 安装
  • SpringBoot文件上传

    文件上传 Spring MVC对文件上传做了简化 xff0c 在Spring Boot中对此做了更进一步的简化 xff0c 文件上传更为方便 Java中的文件上传一共涉及两个组件 xff0c 一个是CommonsMultipartResol
  • Django-图书管理系统(含源码)

    前段时间翻文件发现了以前学习python和django时做的一个系统 xff0c 当时的想法是将这玩意做出来应付web开发大作业 课程设计作业甚至是毕设用的 xff0c 实际上也确实应付了课程设计 xff0c 功能虽然不算多 xff0c 但
  • Android Studio 实现登录注册-源代码 (连接MySql数据库)

    Android Studio 实现登录注册 源代码 xff08 连接MySql数据库 xff09 Android Studio 实现登录注册 源代码 二 xff08 Servlet 43 连接MySql数据库 xff09 Android S