arduino

How can i convert a uint32_t to a char* type

拥有回忆 提交于 2020-12-05 07:24:32
问题 Hello i am using an Arduino UNO with an adafruit shield to display score values but the function used to display scores only accepts char* values and the score itself can occupy up to 6 digits(000,000 to 999,999). i have tried using sprint() but i have had no luck since the screen will flicker like crazy. i believe the problem to be that chars only hold a certain number of bytes that could not fit a 32 bit int but i would think their is a way around this. draw text is the function used by the

How do you convert a String to a float or int?

吃可爱长大的小学妹 提交于 2020-12-02 06:05:23
问题 In an Arduino program I'm working on the GPS sends the coordinates to the arduino through USB. Because of this, the incoming coordinates are stored as Strings. Is there any way to convert the GPS coordinates to a float or int? I've tried int gpslong = atoi(curLongitude) and float gpslong = atof(curLongitude) , but they both cause Arduino to give an error: error: cannot convert 'String' to 'const char*' for argument '1' to 'int atoi(const char*)' Does anyone have any suggestions? 回答1: You can

How do you convert a String to a float or int?

一笑奈何 提交于 2020-12-02 06:05:14
问题 In an Arduino program I'm working on the GPS sends the coordinates to the arduino through USB. Because of this, the incoming coordinates are stored as Strings. Is there any way to convert the GPS coordinates to a float or int? I've tried int gpslong = atoi(curLongitude) and float gpslong = atof(curLongitude) , but they both cause Arduino to give an error: error: cannot convert 'String' to 'const char*' for argument '1' to 'int atoi(const char*)' Does anyone have any suggestions? 回答1: You can

AVR单片机教程——数字IO寄存器

余生长醉 提交于 2020-11-30 14:10:15
前两篇教程中我们学习了LED、按键、开关的基本原理,数字输入输出的使用以及两者之间的关系。我们用到了 pin_mode 、 pin_read 和 pin_write 这三个函数,实际上它们离最底层(至少是单片机制造商允许我们接触到的最底层)就只有一步之遥了。而学单片机要是不了解一点底层,那跟Arduino玩家还有什么区别?(为防止有忠实的Arduino粉丝骂我,我得承认还是有一小部分Arduino玩家是知道本篇教程所介绍内容的。)根本不好意思说自己学过单片机好吧。这所谓的最底层,就是数字IO寄存器了。 在开始之前,你需要下载两份文档: 单片机的 数据手册 。官网链接极慢,我在国内平台上传了 一份 ,在本篇教程写成之时是最新的。 开发板的 原理图 。本应在教程之初就放出来,但事实证明没有原理图也不影响使用。现在是肯定需要的。 等等,你可能还不知道寄存器是什么。那我们就从寄存器开始吧。 寄存器是一类CPU内部的存储器,分为通用寄存器与特殊功能寄存器(8086对特殊功能寄存器还有细分)。通用寄存器,顾名思义是通用的,可以存储操作数、运算结果、内存地址等数据,在使用C语言编程时,一般不直接接触通用寄存器,而由编译器负责安排其使用。特殊功能寄存器有特定的功能,一些作用于CPU内部,如PC存放下一条指令的地址,SP记录内存中栈顶的位置(现在无需了解这些);另一些与IO模组相连接

Arduino Wireless Communication – NRF24L01 Tutorial(arduino无线通信---NRF24L01教程)

ぐ巨炮叔叔 提交于 2020-11-18 20:28:54
arduino下nrf24l01库文件及相关说明 库的说明文档 https://tmrh20.github.io/RF24/ 库的源代码github下载页面 https://tmrh20.github.io/RF24/ Arduino IDE直接安装库文件 直接在arduino库管理器中搜索“rf24”关键字 选择TMRh20作者的版本安装 发送的源码 /* * Arduino Wireless Communication Tutorial * Example 2 - Transmitter Code * * by Dejan Nedelkovski, www.HowToMechatronics.com * * Library: TMRh20/RF24, https://github.com/tmrh20/RF24/ */ #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #define led 12 RF24 radio(7, 8); // CE, CSN const byte addresses[][6] = {"00001", "00002"}; boolean buttonState = 0; void setup() { pinMode(12, OUTPUT); radio.begin(); radio

北工IoT--免费的手机控制单片机解决方案

旧时模样 提交于 2020-11-12 11:53:48
北工IoT--免费的手机控制单片机解决方案 Start.前言 一、北工IoT是什么? 二、接入北工IoT(ESP8266开发板举例) 第一步 配置下位机(将下位机配置成TCP服务器即可) 1.1 方法一 使用ESP8266 AT指令配置 1.2 方法二 Arduino环境下使用ESP8266库开发 1.3 方法三:无需编程,使用北工IoT定制级官方固件 1.4 方法四:海纳百川,兼容并蓄 第二步 配置北工IoT手机APP(功能举例) 2.1 WIFI遥控车系统 2.2 万能控制系统 2.3 WIFI调试通信 三、下载地址 1.小米应用商店下载(传送门:GO) 2.北寒余工作室官网下载(传送门:GO) End.文末福利 Start.前言 如果说 esp8266 给下位机带来了无限可能,那么一款合适的 上位机 也将帮助更多电子爱好者们实现创意的满足。于是乎, 北工IoT 它来了, 无需注册,不分个人用途和商业用途,只要你想用,都就可以免费,更无设备个数限制,连接下位机即可用。 一、北工IoT是什么? 北工IoT视频简介 北工IoT,由北寒余工作室独立开发,为北寒余工作室年度项目--北工IoT系列核心部分。本软件适用所有基于TCP协议的界面交互,接入设备为服务器,按键功能自定义,你可以根据自己需要进行自定义设置,本软件通过WiFi进行连接,TCP协议进行通信,相比蓝牙,红外等方式