1、舵机红色线接开发板5V,棕色线接开发板GND,橙色信号线接开发板数字引脚9。
2、代码。
#include <Servo.h>
Servo myservo; // 定义Servo对象来控制
#define ServerPin 9
// 舵机 控制线 连接 数字9
#define PotentiometerPin A0 // 电位器 控制线 连接 A0
int i = 0; // 角度存储变量
void setup() [阅读全文]
企业信息化建设
1、舵机红色线接开发板5V,棕色线接开发板GND,橙色信号线接开发板数字引脚9。
2、代码。
#include <Servo.h>
Servo myservo; // 定义Servo对象来控制
#define ServerPin 9
// 舵机 控制线 连接 数字9
#define PotentiometerPin A0 // 电位器 控制线 连接 A0
int i = 0; // 角度存储变量
void setup() [阅读全文]
1、电机驱动模块采用 L9110。
2、代码。
const int IA = 7;
//
pin 7 connected to pin IA
const int IB = 8;
//
pin 8 connected to pin IB
byte speed = 255;
// change this (0-255) to control the speed of the motor
void setup() {
pinMode(IA, OU [阅读全文]
1、称重模块采用HX711芯片。
2、代码。
#include "HX711.h" //调用24bitAD HX711库
HX711 HX711_CH0(2, 3, 345); //SCK,DT,GapValue
//SCK引脚用于arduino和HX711模块通讯的时序提供
//DT引脚用于从HX711读取AD的数据
//GapValue用于校准输出的重量值,如果数值偏大就加大该值,如果数据偏小就减小该值
int LED = 13;
long Wei [阅读全文]
1、注意:Arduino Uno、Arduino Mega2650等板子的接法不同。
2、代码:本文使用的是Arduino Mega2650。
/*
* --------------------------------------------------------------------------------------------------------------------
* Example sketch/program showing how to re [阅读全文]
1、注意:超声波模块的有效范围2cm-450cm(300cm以内)。超声波模块直接放在桌面上,距离小于2cm时,会出现数据不准确,例如1187.52cm。
2、代码:
#define TrigPin 2
#define EchoPin 3
float DistanceCM;
void setup()
{
Serial.begin(9600);
pinMode(TrigPin, OUTPUT);
pinMode(EchoPin, INPUT); [阅读全文]
注意:测试过程中由于接线错误导致了步进电机只振动不转。
1、步进电机:28BYJ-48
28:步进电机的有效最大外径是28毫米。
B:表示是步进电机。
Y:表示是永磁式。
J:表示是减速型(减速比1:64)。
48:表示四相八拍。
2、Arduino 代码:
#include <Arduino.h>
#define A1 3 //引脚命名
#define B1 4
#define C1 5
#define D1 6
void [阅读全文]
1、蓝牙模块:HC-05(ZS-040)
2、Arduino 代码:
#define BTSerial
Serial3
#define DEBUGSerial Serial
#define LED_R 2
#define LED_G 3
#define LED_B 4
#define LED_ON
LOW
#define LED_OFF HIGH
const unsigned int BTRxBufferLength = 100;
ch [阅读全文]
本产品内置 HTTP Server,可以通过 PC 机或者手机等其他智能终端的浏览器进行配置,无需其他配置工具或者 APP。在出厂设置中,固件默认工作在 AP 模式,WiFi 模块主动发出来的热点名称为:“Doit_WiFi_xxxxxx”,其中“xxxxxx”是该模块的 MAC 地址后六位。可以使用带无线网卡的 PC 机或者智能手机/平板(支持 Android 和 IOS、Windows Phone 等)连接该热点。热点无密码。
连接成功,使用浏览器访问默认IP地址“192.1 [阅读全文]
1、下载 https://www.emqx.io/cn/downloads#broker
查看centos版本的方法:
(1)、在centos桌面右键“打开终端”。或者用WinSCP客户端。
(2)、接着会弹出终端窗口。
(3)、在里面输入“cat /etc/redhat-release”命令。
(4)、回车后就可以输出centos系统的版本。
(5)、使用“uname -a”命令可以查看内核版本等信息。
2、解压缩 unzip emqx-centos7-4.2 [阅读全文]
#include "TM1637.h"
#define CLK 3 // pins definitions for TM1637 and can be changed to other ports
#define DIO 2
TM1637 tm1637(CLK, DIO);
void setup()
{
tm1637.init();
tm1637.set(BRIGHT_TYPICAL); // BRIGHT_TYPICAL = 2, BRIGHT_DARK [阅读全文]