First Assignment-Address book applet-832201119郑轶恒

832201119郑轶恒 2024-10-31 21:27:06

1.Assignment Description

The purpose of this assignment is to learn to complete an address book development task with front to back interaction. I choose to use wechat mini program development tool to complete this project. In the small program development software, the front-end page can be directly compiled, while the back-end function is written, the data set and cloud function are deployed on the cloud server of wechat small program, and the interaction between the front and back end can be realized by calling the cloud function at the small program development end. The system contains three pages for creating contacts and contact directory contact details. However, due to the influence of market regulation, the content of the small program is suspected of collecting the privacy of others, so it can not pass the audit and release. Therefore, the following blog does not provide links to use, and provides a demonstration of relevant functions

This table shows the basic information of the project and my personal information

Course for This Assignment2401_MU_SE_EE308
Student IDFZU:832201119 MU:22125353
Assignment RequirementsDesign a front-end and back-end separated contact
Objectives of This AssignmentExercise independent learning ability and learn the basic knowledge of software development

2.Github repository address

Here are the front-end and back-end code provided in GitHub, you can click on the link to view

This is the corresponding front-end code:https://github.com/Zeven777-haha/We

This is the back end (cloud function):https://github.com/Zeven777-haha/after-end

3. PSP Table

This is a PSP table showing my expected planned time and actual time for each task at the beginning of the project

PhaseEstimated Time (hours)Actual Time (hours)
Requirements Analysis11
Design34
Frontend Development33
Backend Development58
Testing58
Deployment and Presentation35
Total2029

4. Pruduct Demonstration

Add a contact, and then check it
​​​​​​​​​​​​​​​​
​​​​

img

View and modify existing contact information

img

One-click delete function

img

Interactive viewing of back-end (cloud) information

The front end gets information and uploads it to the back end in real time

img

Including deletion, the information is also immediately reflected in the database

img

These are the basic functions.

5.Description of design and implementation process

img


The diagram shows the framework of my entire project, which includes the cloud function file, the main file (contact details, contact directory and creating contacts (index)), and the global app file.

img

The Cloud Functions folder contains four modules: addContact,deleteContact,getContacts and modifyContact. Each corresponds to the four functions of their nameBecause the basic framework of these four functions is similar, the determination of the cloud function entry file and the setting of the cloud function entry function constitute the main part. Therefore, for one of the contents, addContact is explained here.

// 云函数入口文件 addContact
const cloud = require('wx-server-sdk');
cloud.init();

const db = cloud.database();

// 云函数入口函数
exports.main = async (event, context) => {
  const { name, phone } = event; // 从前端接收参数
  try {
    await db.collection('contacts').add({
      data: {
        name,
        phone
      }
    });
    return { success: true };
  } catch (e) {
    console.error('添加联系人失败:', e);
    return { success: false, error: e };
  }
};

const cloud = require('wx-server-sdk'); : Introduce the cloud development SDK of wechat mini program for connecting to the database.

cloud.init(); Initialize the cloud environment so that cloud functions can call databases and other cloud resources.

const db = cloud.database(); : Creates a database instance db for subsequent database operations.

exports.main = async (event, context) => {... } : Defines the entrance to the cloud function. const { name, phone } = event; : Deconstructs the event parameter from the front end and extracts the name and phone fields.

await db.collection('contacts').add(...) : Adds a new record to the contacts collection. data: {name, phone} : Specifies the content of the record, including name and phone number. return { success: true }; : If the record is successfully added, success: true is returned. catch an exception in a catch statement, print an error, and return success: false with an error message.

For the other three cloud functions, the functions of function initialization, data collection and return are consistent, with only some small differences in individual functions, not much explanation

The next step is to explain the design of the contacts page (index page)
**In index.wxml **

<view class="container">
  <view class="header">
    <text class="title">新建联系人</text>
  </view>

  <!-- 显示头像和上传按钮 -->
  <view class="avatar-section">
    <image class="avatar" src="{{avatarUrl || '/images/default-avatar.png'}}" mode="aspectFill"></image>
    <button bindtap="chooseAvatar">添加照片</button>
  </view>

  <!-- 输入框:姓、名、公司、电话、电子邮件 -->
  <view class="input-section">
    <view class="input-group">
      <text class="label">姓氏</text>
      <input class="input" placeholder="姓氏" bindinput="onLastNameInput" value="{{lastName}}" />
    </view>
    <view class="input-group">
      <text class="label">名字</text>
      <input class="input" placeholder="名字" bindinput="onFirstNameInput" value="{{firstName}}" />
    </view>
    <view class="input-group">
      <text class="label">公司</text>
      <input class="input" placeholder="公司" bindinput="onCompanyInput" value="{{company}}" />
    </view>
    <view class="input-group">
      <text class="label">电话</text>
      <input class="input" placeholder="电话" bindinput="onPhoneInput" value="{{phone}}" />
    </view>
    <view class="input-group">
      <text class="label">电子邮件</text>
      <input class="input" placeholder="电子邮件" bindinput="onEmailInput" value="{{email}}" />
    </view>
  </view>

  <!-- 保存按钮 -->
  <button class="save-btn" bindtap="saveContact">保存联系人</button>
</view>


The view class="container" serves as the main wrapper, organizing the entire page layout. Each view class="input-group" represents a section for a specific piece of contact information, such as surname, given name, and phone number. Inside each input-group, there’s a text class="label" for the field name (like "Last Name") and an input element where users enter data. The placeholder attribute in input displays a hint when the field is empty, and bindinput triggers JavaScript functions (e.g., onLastNameInput) to capture input in real-time, ensuring that the values entered by users are stored in the page’s data model.
The value="{{lastName}}" (or firstName, phone) binds each field to a specific data property, so changes are immediately reflected in the UI and data model. This two-way binding is crucial for dynamic updates.
Finally, the button class="save-btn" bindtap="saveContact" element serves as the submit button. The bindtap attribute links the button to the saveContact function, which executes when the button is tapped. This function will typically send the input data to a cloud database, completing the data entry process and updating the contact list.

In index.wxss

.container {
  padding: 16px;
  background-color: #f5f5f5;
}

.header {
  text-align: center;
  padding: 10px 0;
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 8px;
  border: 2px solid #ddd;
}

.input-section {
  background-color: #ffffff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.input-group {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e5e5ea;
}

.label {
  width: 70px;
  font-size: 16px;
  color: #8e8e93;
}

.input {
  flex: 1;
  font-size: 16px;
  padding: 4px 0;
}

.save-btn {
  background-color: #007aff;
  color: white;
  font-size: 18px;
  text-align: center;
  padding: 12px 0;
  border-radius: 8px;
}

.container: Sets overall padding and layout for the page, creating space around the elements and centering the content.

.input-group: Defines styling for each input section, including padding and alignment. It likely adds spacing between input fields and border separators for visual clarity.

.label: The class for elements that label each field (e.g., "Last Name" or "Phone Number"). This style may include font size, weight, color, and width adjustments for consistency.

.input: Styles the input fields themselves. This might include font size, color, padding, and potentially a border or background color to visually separate the fields.

.save-btn: Styles the save button, setting background color (e.g., blue for prominence), text color (usually white), padding, border-radius for rounded edges, and alignment. It ensures the button stands out and is easy to click.

.delete-btn (if present): Applies a similar style to the save button but with a different color (often red) to indicate caution. This class styles the delete button in the detail page.

In index.js


const db = wx.cloud.database();

Page({
  data: {
    avatarUrl: '', // 头像路径
    lastName: '',
    firstName: '',
    company: '',
    phone: '',
    email: ''
  },

  // 选择头像
  chooseAvatar() {
    wx.chooseImage({
      count: 1,
      sizeType: ['compressed'],
      sourceType: ['album', 'camera'],
      success: res => {
        const filePath = res.tempFilePaths[0];
        this.setData({ avatarUrl: filePath });
      }
    });
  },

  // 输入框事件
  onLastNameInput(e) {
    this.setData({ lastName: e.detail.value });
  },

  onFirstNameInput(e) {
    this.setData({ firstName: e.detail.value });
  },

  onCompanyInput(e) {
    this.setData({ company: e.detail.value });
  },

  onPhoneInput(e) {
    this.setData({ phone: e.detail.value });
  },

  onEmailInput(e) {
    this.setData({ email: e.detail.value });
  },

  // 保存联系人并清空数据
  saveContact() {
    const { avatarUrl, lastName, firstName, company, phone, email } = this.data;

    db.collection('contacts').add({
      data: {
        avatarUrl,
        lastName,
        firstName,
        company,
        phone,
        email
      },
      success: res => {
        wx.showToast({ title: '保存成功', icon: 'success' });
        this.clearForm(); // 清空表单
        wx.navigateBack(); // 返回通讯录页面
      },
      fail: err => {
        wx.showToast({ title: '保存失败', icon: 'none' });
      }
    });
  },

  // 清空表单数据
  clearForm() {
    this.setData({
      avatarUrl: '',
      lastName: '',
      firstName: '',
      company: '',
      phone: '',
      email: ''
    });
  }
});

const db = wx.cloud.database();: Initializes the cloud database instance db, allowing this page to interact with the cloud database, such as adding or querying records

data: Defines the initial state of the page’s data properties, including:

avatarUrl: Stores the path for the avatar image.lastName, firstName, phone, email: Stores contact details to be input by the user

chooseAvatar function: Opens an image picker dialog to select a profile picture.

count: 1: Limits selection to one image.sizeType: ['compressed']: Requests a compressed image for faster upload.sourceType: ['album', 'camera']: Allows choosing from the photo album or taking a new photo.success: res => {...}: After the image is chosen, retrieves its local path (res.tempFilePaths[0]) and updates avatarUrl in data.

saveContact function: Saves the contact information, including avatar, to the database.

Data extraction: Uses destructuring to access avatarUrl, lastName, firstName, phone, and email from data.Database operation:fail callback: If saving fails, shows an error message with wx.showToast.success callback: Shows a success message with wx.showToast and navigates back to the previous page.data: Specifies the fields to store, mapping avatarUrl, lastName, firstName, phone, and email. db.collection('contacts').add({...}): Adds a new contact record to the contacts collection.

The above completes the explanation of the code in the index folder, in order to keep the blog as simple as possible, please go to github to see the detailed code.

Next, I will continue to explain the Contact page and the contactDetail page. As for the wxss page, because the content is very similar to index.wxss, I will pay more attention to the explanation of.js and.ml files

contact.js

const db = wx.cloud.database();

Page({
  data: {
    contacts: [],
  },

  onShow() {
    this.getContactsFromDB();
  },

  getContactsFromDB() {
    db.collection('contacts').get({
      success: res => {
        const contacts = res.data.map(contact => ({
          ...contact,
          fullName: `${contact.lastName}${contact.firstName}`
        }));
        this.setData({ contacts: contacts });
      }
    });
  },

  goToContactDetail(e) {
    const id = e.currentTarget.dataset.id;
    if (id) {
      wx.navigateTo({
        url: `/pages/contactDetail/contactDetail?id=${id}`
      });
    } else {
      wx.showToast({ title: '无法找到联系人详情', icon: 'none' });
    }
  }
});


Initialize Database:

const db = wx.cloud.database(); initializes a connection to the cloud database, allowing interaction with collections (in this case, contacts).

Data Object:

data: { contacts: [] } initializes an empty contacts array to store contact data fetched from the database.

onShow() Function:

Called each time the page is shown, it invokes getContactsFromDB() to refresh contact data.

getContactsFromDB() Function:

Fetches all documents from the contacts collection and maps each contact, adding a fullName property combining lastName and firstName. It then updates contacts in data to display the contact list.

goToContactDetail() Function:

Redirects to the contact detail page when a contact is selected. It retrieves the contact’s id from data-id and navigates to /pages/contactDetail/contactDetail?id=${id}, or shows an error if no id is found.

contact.wxml

<view class="container">
  <!-- 顶部标题 -->
  <view class="header">
    <text class="title">牢6的通讯录</text>
  </view>

  <!-- 联系人列表 -->
  <block wx:for="{{contacts}}" wx:key="id">
    <view class="contact-item">
      <!-- 左侧显示姓名 -->
      <text class="contact-name">{{item.fullName}}</text>
      <!-- 右侧显示查看详情按钮 -->
      <button class="detail-button" bindtap="goToContactDetail" data-id="{{item._id}}">查看详情</button>
    </view>
    <!-- 分隔线 -->
    <view class="divider"></view>
  </block>
</view>



Outer Container (view class="container"):

Wraps the entire contact list interface, setting up a consistent structure and applying styling for layout.

Title Section (view class="header"):

Displays a fixed title, “牢6的通讯录,” at the top of the page using a element. This serves as a header to provide context for the page.

Contact List Block (block wx:for="{{contacts}}" wx:key="id"):

Loops over the contacts data array, rendering each contact’s information. The wx:for directive iterates through contacts, with wx:key="id" ensuring that each item is uniquely identified by id, improving rendering performance.

Contact Item (view class="contact-item"):

Represents each contact entry in the list, with two key elements:Contact Name (text class="contact-name"{{item.fullName}}): Displays the full name of the contact, extracted from item.fullName within the contacts array.Details Button (查看详情): Adds a button labeled "查看详情" ("View Details") on the right side of each contact. The button triggers the goToContactDetail function when tapped, passing the contact’s unique _id as a data-id attribute, which helps identify the specific contact.

Divider (view class="divider"/view):

A styled separator line that visually separates each contact in the list, providing a clear distinction between entries for improved readability.

contactDetail.js

const db = wx.cloud.database();

Page({
  data: {
    contact: {}
  },

  onLoad(options) {
    const id = options.id;
    if (id) {
      this.getContactDetail(id);
    } else {
      wx.showToast({ title: '加载联系人失败', icon: 'none' });
    }
  },

  // 获取联系人详情
  getContactDetail(id) {
    db.collection('contacts').doc(id).get({
      success: res => {
        this.setData({ contact: res.data });
      },
      fail: err => {
        wx.showToast({ title: '加载失败', icon: 'none' });
      }
    });
  },

  // 修改头像
  changeAvatar() {
    const { contact } = this.data;

    wx.chooseImage({
      count: 1,
      sizeType: ['compressed'],
      sourceType: ['album', 'camera'],
      success: res => {
        const filePath = res.tempFilePaths[0];
        db.collection('contacts').doc(contact._id).update({
          data: { avatarUrl: filePath },
          success: () => {
            wx.showToast({ title: '头像更新成功', icon: 'success' });
            this.setData({ 'contact.avatarUrl': filePath });
          },
          fail: err => {
            wx.showToast({ title: '头像更新失败', icon: 'none' });
          }
        });
      }
    });
  },

  // 输入框事件处理
  onLastNameInput(e) {
    this.setData({ 'contact.lastName': e.detail.value });
  },

  onFirstNameInput(e) {
    this.setData({ 'contact.firstName': e.detail.value });
  },

  onCompanyInput(e) {
    this.setData({ 'contact.company': e.detail.value });
  },

  onPhoneInput(e) {
    this.setData({ 'contact.phone': e.detail.value });
  },

  onEmailInput(e) {
    this.setData({ 'contact.email': e.detail.value });
  },

  // 保存更改
  saveChanges() {
    const { contact } = this.data;
    db.collection('contacts').doc(contact._id).update({
      data: {
        lastName: contact.lastName,
        firstName: contact.firstName,
        company: contact.company,
        phone: contact.phone,
        email: contact.email
      },
      success: () => {
        wx.showToast({ title: '更新成功', icon: 'success' });
        wx.navigateBack();
      },
      fail: () => {
        wx.showToast({ title: '更新失败', icon: 'none' });
      }
    });
  },

  // 删除联系人
  deleteContact() {
    const { contact } = this.data;
    wx.showModal({
      title: '确认删除',
      content: '确定要删除该联系人吗?',
      success: (res) => {
        if (res.confirm) {
          db.collection('contacts').doc(contact._id).remove({
            success: res => {
              wx.showToast({ title: '删除成功', icon: 'success' });
              wx.navigateBack();
            },
            fail: err => {
              wx.showToast({ title: '删除失败', icon: 'none' });
            }
          });
        }
      }
    });
  }
});

Initialize Cloud Database:

const db = wx.cloud.database(); sets up a connection to the cloud database, allowing read/write operations on the contacts collection.

Data Object:

data: { contact: {} } initializes an empty contact object that will store contact details from the database.

onLoad Function:

Runs when the page loads. It extracts the contact id from options and calls getContactDetail to retrieve contact details, displaying an error if no id is found.

getContactDetail Function:

Fetches a specific contact’s details using their id. If successful, it stores this data in contact; otherwise, it displays an error.

Avatar Change Function:

changeAvatar: Allows users to select a new avatar image using wx.chooseImage, then updates avatarUrl in the database and local data to reflect the change.

Input Handling Functions:

onLastNameInput, onFirstNameInput, onCompanyInput, onPhoneInput, onEmailInput capture user inputs for various fields and store the values in the contact object. This makes the data ready for saving or updating.

Saving Changes:

saveChanges: Saves modified contact data to the database. It updates fields in contact and displays a success message upon completion.

Deleting Contact:

deleteContact: Shows a confirmation prompt and deletes the contact from the database if confirmed, displaying a success or failure message accordingly.

contactDetail.wxml

<view class="container">
  <view class="header">
    <text class="title">联系人详情</text>
  </view>

  <view class="avatar-section">
    <image class="avatar" src="{{contact.avatarUrl || '/images/default-avatar.png'}}" mode="aspectFill"></image>
    <button bindtap="changeAvatar">{{contact.avatarUrl ? '更改照片' : '添加照片'}}</button>
  </view>

  <view class="input-section">
    <view class="input-group">
      <text class="label">姓氏</text>
      <input class="input" placeholder="姓氏" bindinput="onLastNameInput" value="{{contact.lastName}}" />
    </view>
    <view class="input-group">
      <text class="label">名字</text>
      <input class="input" placeholder="名字" bindinput="onFirstNameInput" value="{{contact.firstName}}" />
    </view>
    <view class="input-group">
      <text class="label">公司</text>
      <input class="input" placeholder="公司" bindinput="onCompanyInput" value="{{contact.company}}" />
    </view>
    <view class="input-group">
      <text class="label">电话</text>
      <input class="input" placeholder="电话" bindinput="onPhoneInput" value="{{contact.phone}}" />
    </view>
    <view class="input-group">
      <text class="label">电子邮件</text>
      <input class="input" placeholder="电子邮件" bindinput="onEmailInput" value="{{contact.email}}" />
    </view>
  </view>

  <button class="save-btn" bindtap="saveChanges">保存更改</button>
  <button class="delete-btn" bindtap="deleteContact">一键删除</button>
</view>



Container (view class="container"): The outer wrapper for the contact details page layout, defining spacing and alignment.

Header (view class="header"): Displays the page title "联系人详情" at the top.

Avatar Section (view class="avatar-section"): Displays the contact's avatar. The src="{{contact.avatarUrl || '/images/default-avatar.png'}}" attribute checks if avatarUrl exists; if not, it defaults to /images/default-avatar.png. The mode="aspectFill" scales the image proportionally to fill the space.

Contact Info Section (view class="input-section"): Contains fields like last name, first name, company, phone, and email, each with:

Label (text class="label"): Shows the field’s name, e.g., "姓氏" or "电话".Info (text class="info"): Displays the actual data for each field using the contact object’s properties (e.g., contact.lastName).

Delete Button (button class="delete-btn" bindtap="deleteContact"): A button at the bottom labeled "一键删除". The bindtap="deleteContact" event calls the deleteContact function when clicked, enabling deletion of the contact.

This setup provides a structured contact details view with options to display, scale, and delete contact data.

6.brief summary

Creating this WeChat Mini Program has been a valuable learning experience, teaching me both the practical and conceptual aspects of front-end and back-end development. I gained hands-on experience with key tools and techniques, such as cloud database management, real-time data binding, and handling user interactions. Working through each stage of the app—structuring UI, implementing data handling, and integrating cloud functions—deepened my understanding of building responsive, user-friendly applications and sharpened my problem-solving skills when addressing challenges in functionality and design.

...全文
90 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
源码下载地址: https://pan.quark.cn/s/a4b39357ea24 Altium Designer 18是一款功能丰富的电子设计自动化工具,其集成了电路原理图绘制、PCB布局规划、三维视图展示、电路仿真分析以及生产文件生成等多项核心功能,为电子工程师们提供了一个全面的硬件设计解决方案。该软件的官方中文指导材料系统地阐述了从项目初始阶段到最终完成的全过程操作方法。 在“AD18 官方中文指导材料”中,使用者可以掌握以下核心内容要点: 1. **系统配置与界面认知**:熟悉Altium Designer 18的工作平台,涵盖菜单选项、工具栏配置、工作区域安排,以及个性化工作界面的设定方法。 2. **项目创建流程**:掌握如何建立新的项目工程,包括工程参数配置、项目模板选取,以及项目文件的添加操作。 3. **电路图绘制技术**:学习电路原理图的绘制流程,包括元件库的维护管理、元件放置技巧、连接线路绘制、属性编辑操作,以及网络表的自动生成方法。 4. **元件库构建与管理**:了解如何建立自定义元件库,执行元件的导入与导出任务,以及利用Altium Designer自带的元件资源库。 5. **PCB布局设计方法**:掌握PCB设计的基本准则,如元件布局策略、布线技巧、层叠结构调整、布线规则优化,以及冲突检测与短路处理技术。 6. **设计规范与约束条件**:理解设定设计规范和电气约束条件的关键性,包括间距参数设定、焊盘尺寸规格、过孔尺寸要求等,以及运用规则检查进行设计验证的流程。 7. **三维模型整合应用**:学习如何将三维模型与PCB设计内容相结合,以实现更为直观的机械配合验证。 8. **电路性能仿真技术**:掌握使用Altium Des...
源码链接: https://pan.quark.cn/s/a4b39357ea24 ### 接口测试知识要点说明 #### 一、接口测试的定义及分类 1. **概念阐释**: - 接口测试作为软件测试的关键环节,主要对系统之间的交互点进行验证。 - 它旨在核实接口的正确性、稳定性和功能性,保障各个系统组件能够依照预期执行交互操作。 2. **实施情境**: - 适用于多系统联合开发的环境。 - 适用于包含多个子系统的复杂应用系统开发过程。 3. **适用范围**: - 为其他系统提供支持的底层基础架构系统。 - 负责协调中心服务的系统架构。 4. **分类标准**: - **模块接口测试**:通常作为单元测试的一部分,适用于独立构建的功能模块。 - **Web接口测试**: - **服务端接口测试**:针对客户端与服务器端之间的接口进行验证。 - **外部接口测试**:对第三方提供的接口进行测试,例如支付平台提供的授权登录接口。 5. **测试角度**: - **接口功能验证**:核实接口功能是否满足预期要求。 - **接口性能评估**:衡量接口的处理能力及响应时间。 - **接口稳定性考察**:检测接口在长时间运行中的表现情况。 - **接口安全检测**:确保接口能够抵御非法访问或数据篡改。 6. **测试手法**: - **参数细致测试**:深入测试接口的输入参数和输出结果。 - **场景模拟测试**:依据实际业务场景进行测试验证。 #### 二、接口测试的详细流程 1. **测试规划**: - 明确测试范围、目标及所需资源。 - 规划测试策略,选择适宜的工具和技术手段。 2. **测试用例设计**: - 依据需求文档和接口规格文档设计测试用例。 - 覆...
内容概要:本文研究基于遗传算法(GA)与粒子群算法(PSO)相结合的无人机三维路径规划方法,旨在解决无人机在复杂三维环境中避障与路径优化的关键问题。通过构建包含障碍物、威胁区域等约束的三维仿真环境,系统实现了GA与PSO两种智能优化算法的Matlab代码,并对其在路径规划中的性能进行全面对比分析,重点关注路径长度、飞行安全性、算法收敛速度等核心指标。研究充分利用GA的全局搜索能力与PSO的快速局部收敛特性,提出一种混合优化策略,有效克服单一算法易陷入局部最优或收敛缓慢的缺陷。文中不仅详细阐述了算法的设计流程、数学模型与实现细节,还提供了完整的仿真结果,验证了所提混合方法在复杂动态场景下的优越性、有效性和鲁棒性,为无人机自主导航提供了可靠的理论依据和技术方案。; 适合人群:具备一定Matlab编程基础和优化算法理论知识,从事无人机系统设计、智能控制、路径规划、人工智能应用等相关领域研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①应用于城市峡谷、山区、灾害救援等复杂三维环境中的无人机自主避障与最优任务路径规划;②为智能优化算法(GA、PSO及其混合策略)的学习、性能对比与工程化应用提供详实的实践案例和代码参考;③服务于高校科研教学、算法原型快速复现、以及在此基础上的进一步改进与创新研究。; 阅读建议:建议读者结合所提供的Matlab代码进行仿真运行与调试,深入理解两种算法的参数设置、适应度函数设计及路径生成机制,可通过修改环境地图、增加动态障碍物或调整优化目标函数等方式进行扩展性研究,以深化对算法本质和应用场景的理解。
内容概要:LTK8870S是一款单通道H桥有刷直流电机驱动器,支持6.5V至20V工作电压,具备3.0A峰值电流驱动能力,适用于打印机、家用电器及工业设备等机电一体化应用。该芯片采用PWM控制接口,可通过IN1和IN2逻辑输入实现电机正转、反转、滑行与制动等多种工作模式,并支持快衰减和慢衰减两种电流衰减方式以优化电机控制性能。器件集成电流调节功能,通过VREF引脚和外部检测电阻设定限流值,有效控制电机电流并降低系统功耗。同时具备低功耗休眠模式,在IN1和IN2均为低电平时自动进入,显著节省能耗。LTK8870S还集成了多重保护机制,包括VM欠压锁定(UVLO)、过温保护(TSD)、过流保护(OCP)及自动故障恢复功能,提升系统可靠性。其ESOP-8封装带裸露焊盘,利于散热,符合无铅环保标准。; 适合人群:电子硬件工程师、电机控制系统开发者、嵌入式系统设计人员,尤其适用于从事电机驱动电路设计的中级技术人员。; 使用场景及目标:①用于控制中小型有刷直流电机的正反转与调速;②应用于需要电流限制和节能休眠功能的电池供电设备;③作为工业自动化、智能家电或办公设备中的核心驱动模块;④帮助开发者理解H桥驱动、PWM调速、电流衰减模式及保护电路的设计原理。; 阅读建议:此资源技术细节丰富,建议结合典型应用电路图与电气参数表进行硬件设计参考,重点关注PWM控制逻辑、电流调节设置及保护机制的实现方式,并在实际应用中配合示波器调试输出波形与电流响应。

173

社区成员

发帖
与我相关
我的任务
社区描述
2401_MU_SE_FZU
软件工程 高校
社区管理员
  • FZU_SE_TeacherL
  • 助教-吴可仪
  • 助教-孔志豪
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧