Arduino机器人快速上手经验分享(L298N马达驱动,摇杆模块)

本文分享了使用Arduino Uno搭建机器人的经验,包括使用L298N马达驱动模块控制直流马达,配合9V电池、摇杆模块进行操作。提供了详细的材料清单、接线图和演示视频,适合初学者快速上手。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Bill of Material:
直流马达(<9V, 2A) x2, 底盘 x1,9V电池 x1, 电池扣 x1, 摇杆模块 x1, L298N 马达驱动模块 x1, Arduino Uno x1, 面包板线。

.演示视频,拼装教程:

Arduino机器人快速上手经验分享

接线图
在这里插入图片描述
程式/代码:

/*  
  Demonstrates the use of Joystick control with Arduino UNO and L298N Motor Driver MOdule.
  
  Last Edited: Jan.4th.2020 by Mun Kim
*/
  
int in1 = 3; // Direction Control: Motor 1(Left Hand Side) 
int in2 = 4; // Direction Control: Motor 1(Left Hand Side) 
int enA = 5; // Power Control: Motor 1

int in3 = 7; // Direction Control: Motor 2 (Right Hand Side) 
int in4 = 8; // Direction Control: Motor 2 (Right Hand Side) 
int enB = 9; // Power Control: Motor 2 

int MotorSpeed1 = 0; // Motor 1 Speed Values - Start at zero
int MotorSpeed2 = 0; // Motor 2 Speed Values - Start at zero

int joyHorz = A0; // Joystick Input: Horizontal(X-axis)
int joyVert = A1; // Joystick Input: Vertical(Y-axis)  

// Joystick Values - Start at 512 (middle position)
int joyposVert = 512;
int joyposHorz = 512;  

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值