arduino

Returning different parts of a char array arduino

坚强是说给别人听的谎言 提交于 2020-04-17 21:30:29
问题 I asked a question here about my issue and thanks to @enhzflep I solved the huge part of my problem. My problem was if I write 46754!ABCDEFG12345#qwerwe to the serial, I want to get AB which is two chars after '!'. The code below does this work perfectly. However now I need to get 'CD', 'EF', three chars before '#' (for my example it means '345') and the whole thing between these things which is 'G12' the size of 'G12' depends on the size of the whole thing between '!' and '#'. In short I

Returning different parts of a char array arduino

别说谁变了你拦得住时间么 提交于 2020-04-17 21:30:27
问题 I asked a question here about my issue and thanks to @enhzflep I solved the huge part of my problem. My problem was if I write 46754!ABCDEFG12345#qwerwe to the serial, I want to get AB which is two chars after '!'. The code below does this work perfectly. However now I need to get 'CD', 'EF', three chars before '#' (for my example it means '345') and the whole thing between these things which is 'G12' the size of 'G12' depends on the size of the whole thing between '!' and '#'. In short I

getting the first n elements of a specified char array arduino

本秂侑毒 提交于 2020-04-17 21:13:06
问题 My aim is reading some string from serial for example 234124!3455addg#5867 if the program sees ! it should start to add it to a char array and if it sees # it should return the first 4 elements of that char array for my example the return should be 3455. How can I solve it? I made this using String class but I need to implement it to char array. I am quite new on arduino so please be clear thank you. Here is my code: const char *s = "123123123!0037selam#aaaaSDSDa"; const char *CHAR1 = "!";

getting the first n elements of a specified char array arduino

点点圈 提交于 2020-04-17 21:11:43
问题 My aim is reading some string from serial for example 234124!3455addg#5867 if the program sees ! it should start to add it to a char array and if it sees # it should return the first 4 elements of that char array for my example the return should be 3455. How can I solve it? I made this using String class but I need to implement it to char array. I am quite new on arduino so please be clear thank you. Here is my code: const char *s = "123123123!0037selam#aaaaSDSDa"; const char *CHAR1 = "!";

Arduino使用红外模块

被刻印的时光 ゝ 提交于 2020-04-14 16:04:40
【推荐阅读】微服务还能火多久?>>> Arduino连接测试E18-D80NK红外开关传感器 本文我们将通过Arduino连线E18-D80NK红外开关传感器进行简单测试, E18-D80NK 是一个高灵敏度的红外光线开关传感器,它可以用来检测物体或者作为光电开关使用,测量检测范围从3cm到80cm。 供电电压: 5V DC 工作电流:< 25mA 最大负载电流 100mA ( NPN 集电极开路下拉输出) 响应时间: <2ms 直径: 17MM 指向角: ≤ 15 °, 有效范围3-80CM可调 检测的对象: 透明或不透明 工作环境温度: -25℃+55℃ 外壳材料: 塑料 导线长度: 45CM E18-D80NK市面上有两种版本,区别在于线缆颜色不同,一种是棕黑蓝三色线分别对应+5V,OUT和GND;一种是红黄黑三色线分别对应 +5V,OUT和GND 。上图的引脚定义图是前者。 void setup(){ Serial.begin(9600); //Start serial communication boud rate at 9600 pinMode(2,INPUT); //Pin 2 as signal input } void loop(){ while(1){ delay(500); if(digitalRead(2)==LOW){ // If no signal

How to make Arduino run a script

ε祈祈猫儿з 提交于 2020-04-14 02:23:58
问题 i'm a software developer but i'm new to Arduino, and to the electronics world. I would like to build a simple project that combined both, and really appreciate any help where to start. final project should be Arduino with a button and a LED, when tapping the button I want run a script on my mac, then if the script finished successfully i want to turn on the LED I already saw some tutorial about how to use buttons and LEDs so the main thing i'm interested here is how communicate from the

How to make Arduino run a script

浪子不回头ぞ 提交于 2020-04-14 02:22:25
问题 i'm a software developer but i'm new to Arduino, and to the electronics world. I would like to build a simple project that combined both, and really appreciate any help where to start. final project should be Arduino with a button and a LED, when tapping the button I want run a script on my mac, then if the script finished successfully i want to turn on the LED I already saw some tutorial about how to use buttons and LEDs so the main thing i'm interested here is how communicate from the

How to make Arduino run a script

断了今生、忘了曾经 提交于 2020-04-14 02:22:08
问题 i'm a software developer but i'm new to Arduino, and to the electronics world. I would like to build a simple project that combined both, and really appreciate any help where to start. final project should be Arduino with a button and a LED, when tapping the button I want run a script on my mac, then if the script finished successfully i want to turn on the LED I already saw some tutorial about how to use buttons and LEDs so the main thing i'm interested here is how communicate from the

How to make Arduino run a script

拈花ヽ惹草 提交于 2020-04-14 02:22:01
问题 i'm a software developer but i'm new to Arduino, and to the electronics world. I would like to build a simple project that combined both, and really appreciate any help where to start. final project should be Arduino with a button and a LED, when tapping the button I want run a script on my mac, then if the script finished successfully i want to turn on the LED I already saw some tutorial about how to use buttons and LEDs so the main thing i'm interested here is how communicate from the

arduino电子艺术--PWM直流电机电调实验

孤者浪人 提交于 2020-04-12 12:09:39
arduino电子艺术--PWM直流电机电调实验 相信爱上 arduino 会让你变成电子艺术家 ----- 作者: einyboy or alert 2012-12-15 日早上,忙里偷闲做了“ PWM 直流电机控制实验”这个实验。 PWM 电调算是一种比较低级的自动控制技术,所谓的低级就是精度,跟态度恨不能无法调整。更高级的自动控制技术要用到 PID 了。本人非电专业,在大学时自觉完成“信号与系统”,“自动控制”这两们课程,下一个电机实验终于可以用上 PID 这些自动控制的东西了。 一、 电子装备 Arduino uno 板 1 块 L298 双桥驱动版 1 块 导线若干 直流减速电机 1 个 一、 电路连接说明 L298N out1 , out2 分别直接电机引用 L298N N1,N2 分别接 arduino 10 , 11 引脚 L298N ENA 使能端接 arduino 6 引脚,高电平有效 L298N +5V 脚接 arduino +5V L298N GND 脚接 arduino GND 一、 实验功能点 1. 电机停止,正转,反转 2. PWM 调速 代码: 一、 后续改进 1. 通过比例 - 积分 - 微分 PID 控制器进行精确自动调整 2. 通过蓝牙控制电机转动。 来源: oschina 链接: https://my.oschina.net/u