arduino

Splitting a comma separated string through serial (Arduino)

前提是你 提交于 2020-12-31 06:40:06
问题 So my arduino is receiving a string from serial, comprising of three values separated by commas, I'm trying to separate these values into three different variables, the rest I can do. The string looks something like this "1000,1.5,0.9" or "5000,20,0.01" I would like something like: a - 1000, b - 1.5, c - 0.9 Cheers 回答1: I presume you are receiving the string that can be split in to three parts. Here's a sample code taken from this thread: void setup(){ Serial.begin(9600); } void loop(){

Splitting a comma separated string through serial (Arduino)

匆匆过客 提交于 2020-12-31 06:36:49
问题 So my arduino is receiving a string from serial, comprising of three values separated by commas, I'm trying to separate these values into three different variables, the rest I can do. The string looks something like this "1000,1.5,0.9" or "5000,20,0.01" I would like something like: a - 1000, b - 1.5, c - 0.9 Cheers 回答1: I presume you are receiving the string that can be split in to three parts. Here's a sample code taken from this thread: void setup(){ Serial.begin(9600); } void loop(){

Splitting a comma separated string through serial (Arduino)

白昼怎懂夜的黑 提交于 2020-12-31 06:34:49
问题 So my arduino is receiving a string from serial, comprising of three values separated by commas, I'm trying to separate these values into three different variables, the rest I can do. The string looks something like this "1000,1.5,0.9" or "5000,20,0.01" I would like something like: a - 1000, b - 1.5, c - 0.9 Cheers 回答1: I presume you are receiving the string that can be split in to three parts. Here's a sample code taken from this thread: void setup(){ Serial.begin(9600); } void loop(){

Ardunio完成STM32板子的串口通信

谁说我不能喝 提交于 2020-12-28 01:17:05
目录 一、实验准备 二、实验过程 Arduino的下载安装 三、实验结果 一、实验准备 实验环境:Arduino-1.8.12 开发板:STM32F103 野火指南者 二、实验过程 Arduino的下载安装 进入Arduino官网进行下载并下载STM32-master 下载完成后将STM32-master文件复制到/Ardunio\arduino-1.8.13\hardware目录下 打开arduino应用程序,选择工具——>开发板——>开发板管理器,在搜索框搜索SAM 选择Cortex-M3系列的文件编译并安装,过程可能需要几分钟,请耐心等待 安装完成后打开串口调试工具,查看开发板连接在电脑的哪个接口上,再返回Arduino选择自己的开发板配置好相关信息 将代码输入 void setup ( ) { //initialize digital pin LED_BUILTIN as an output. pinMode ( PB9 , OUTPUT ) ; Serial . begin ( 9600 ) ; } // the loop function runs over and overagain forever void loop ( ) { digitalWrite ( PB9 , HIGH ) ; //turn the LED on (HIGH is the voltage

How to `Serial.print()` “full” hexadecimal bytes?

橙三吉。 提交于 2020-12-26 06:32:16
问题 I am programming Arduino and I am trying to Serial.print() bytes in hexadecimal format "the my way" (keep reading for more information). That is, by using the following code byte byte1 = 0xA2; byte byte2 = 0x05; byte byte3 = 0x00; Serial.println(byte1, HEX); Serial.println(byte2, HEX); Serial.println(byte3, HEX); I get the following output in the Serial Monitor: A2 5 0 However I would like to output the following: A2 05 00 In words, I would like to print the "full" hexadecimal value including

单片机控制两相四线步进电机控制

眉间皱痕 提交于 2020-12-25 05:55:04
先来图看看,没忍住全部抄下来:(感谢万能的淘宝,以及商家 8毛钱一个还要啥自行车 @ https://item.taobao.com/item.htm?spm=a230r.1.14.65.472f69f3zFqx6H&id=590142046187&ns=1&abbucket=8#detail) 手头有个STC89C51开发板,送的就是上边的步进电机。也不太懂这四个线的作用,好在有百度。百度了是arduino,单片机的也有。 控制方法见这里:https://wenku.baidu.com/view/8579bf2349649b6649d747ea.html 第四页下侧。 看了之后该电机可以4拍8拍的运行。步进电机的特点是,误差不累积。 单片机不能直接控制它,因为电流不够。开发板上有个 TC1508S (https://wenku.baidu.com/view/6e6dbe0302d8ce2f0066f5335a8102d276a261b7.html) 专门是用来做玩具马达的。这个片子很容易,输入四个 ,输出四个 可以控制两个直流电机(突然我有开玩具厂做遥控车的想法,哈哈)做到真正的四驱。 这里也可以控制好输出的时序来控制这个两线四相的步进电机。关于连线附属电容参看TC1508S的内容。 用了P1的0,1,2,3端口 接 TC1508S的 ina inb inc ind

WIFI小车APP远程控制,无线智能小车之ESP8266例程

时光总嘲笑我的痴心妄想 提交于 2020-12-25 03:39:21
WIFI小车无线远程控制,智能小车之ESP8266例程 原理讲解 小车改装 ESP8266 例程代码 WIFI配网 程序测试 安卓app制作 原理讲解 原理简述:利用发布订阅模式,即:利用ESP8266 订阅了一个主题,再利用app inventor 编写的app 往这个主题发布消息,由于ESP8266 订阅了这个消息,所以就可以收到app发布得消息,从而执行相应得动作,比如前进\后退\左转\右转。 小车改装 如果有小车的话可以进行改装,改装成WIFI小车,如果没有小车的话,可以现行组装。 STM32改装方案: 建议采用串口通信的方式,ESP8266可以收到手机app发来的控制指令,如果ESP8266收到指令,可通过串口给stm32发送信息,stm32收到指令后,对小车执行相关动作即可。 arduino uno 改装方案 : 方案一 ,这个可以采用和stm32一样的原理,利用串口通信,esp8266收到云端指令,通过串口给arduino 发信息,arduino收到串口信息,对小车执行相关动作即可。 方案二 ,更换NodeMCU开发板,把arduino uno 更换为NodeMCU开发板,直接用NodeMCU当作小车的动作控制器,这种方式比较推荐,较为简单,nodeMCU收到云端指令,直接执行小车动作函数即可。NodeMCU编程完全兼容arduino开发,更换的时候

基于arduino的串口控制数码管(5611AH)显示数字(初学,入门级附代码)

时光怂恿深爱的人放手 提交于 2020-12-21 10:32:21
基于arduino的串口控制数码管(5611AH)显示数字只有干货 首先先要介绍一下数码管了,这里图片为5611AH,这种数码管主要分为 共阴极 和 共阳极 两种,这里用的是共阴极的。 注意区分 话不多说,直接上图片(此图为模拟图,当然我有实物,实物比较麻烦)。 好了,上代码 ,当串口输入1~9是,数码管将显示相应数值。 此代码较为简单易懂。(代码用到了数组),注意数组规定为几行几列但用的时候是从0行0列开始的。 int ab = 3 ; int bp = 2 ; int cg = 9 ; int db = 10 ; int ep = 11 ; int fg = 12 ; int gy = 13 ; int pw = 8 ; int i = - 1 ; int income = 0 ; int a [ 10 ] [ 8 ] = { 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , //0 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , //1 1 , 1 , 0 , 1 , 1 , 0 , 1 , 0 , //2 1 , 1 , 1 , 1 , 0 , 0 , 1 , 0 , //3 0 , 1 , 1 , 0 , 0 , 1 , 1 , 0 , //4 1 , 0 , 1 , 1 , 0 , 1 , 1 , 0 , //5 1 , 0 , 1 , 1

用 Arduino Uno 给 Arduino Mini(Pro)烧录程序

走远了吗. 提交于 2020-12-19 12:04:29
用 Arduino Uno 给 Arduino Mini(Pro)烧录程序 准备 Arduino Uno Arduino Mini(Pro) 杜邦线若干 接线 首先去掉 Arduino 上的芯片ATMEGA328P 接线 Uno —– Mini 0(RX) – 0(RX) 1(TX) – 1(TX) VCC —- VCC GND —- GND RESET – RST 刷入程序 将 Arduino 连接至计算机 在 工具 -> 板 中找到所相应的 Arduino 板子(Arduino Pro or Pro Mini) 在 工具 -> port中找到 A4对弄相应port(Mac 上是/dev/tty.usbmodem* 或 /dev/tty.usbserial*) 输入演示样例 Sketch(blink) 文件 -> 演示样例 -> 01.Basic -> Blink 然后在 IDE 中点击 『上传』 完毕上传后。Arduino Mini(Pro) 灯開始闪烁 版权声明:本文为博主原创文章,未经博主同意不得转载。 文章来源: http://blog.luoyuanhang.cn 来源: oschina 链接: https://my.oschina.net/u/4382082/blog/4249474

Arduino uno 对esp-01s 进行固件烧录

放肆的年华 提交于 2020-12-19 11:20:44
1、接线 esp-01s arduino nano 扩展unoR3 3.3v 3.3v rx rx0 tx tx0 rst gnd(烧录前接线拔掉重置esp) io0 gnd(烧录时接入) en 3.3v io2 悬空 gnd gnd 2、arduino ide 配置 3、上传代码 、上传成功 拔掉io0 进入运行模式 arduino nano 烧录最简单的blink 防止对esp烧录时干扰 接线要短,防止烧录失败。 esp 串口波特率115200 串口监视工具可查看打印日志 来源: oschina 链接: https://my.oschina.net/u/2307139/blog/4816235