arduino

Reading from serial port in a Ruby on Rails application hangs

。_饼干妹妹 提交于 2020-01-13 10:53:15
问题 I'm using the serialport gem to read from the serial port in my Ruby on Rails 3.2 application. The serial port itself is used to write data from an Arduino board. The gem is added to Gemfile . The port is initialized in application.rb : config.serial_port = SerialPort.new "/devttyACM0", 9600 config.serial_port.read_timeout = 100 The problem appears when I try to read from this port. @sp = ProjectName::Application::config.serial_port @sp.read The application hangs deadly. I've tried to perform

Input/output error using Python module SMBus, a Raspberry Pi and an Arduino

ⅰ亾dé卋堺 提交于 2020-01-13 08:26:08
问题 I have connected a Raspberry Pi and Rainbowduino together with a homemade I²C level shifter, and installed the Python module SMBus, the Raspberry Pi can communicate with the Rainbowduino, but every so often I get an input/output error message when trying the command bus.write_i2c_block_data(address, signal, data) . It says: IOError: [Errno 5] Input/output error Why does it happen and how do I fix or ignore these errors? 回答1: Long story short alot of people are plagued by this, I found a very

Arduino基础一文通

こ雲淡風輕ζ 提交于 2020-01-11 23:04:40
(Arduino基础一文通) 此文旨在记录arduino的一些基本语法,以备自己后续查用,并没有任何的讲解和分析, 如果您是电子爱好者,想学习arduino,请寻找合适的教材学习; 如果您有编程基础,想短时间内粗略了解arduino,则完全可以。 第一部分 基础 一、Arduino程序结构 草图启动时会调用setup()函数。使用它来初始化变量,引脚模式,启用库等。setup函数只能在Arduino板的每次上电或复位后运行一次。 在创建了用于初始化并设置初始值的setup()函数后,loop()函数,正如它的名称所指,允许你的程序连续循环的更改和响应。可以使用它来主动控制Arduino板。 二、Arduino数据类型 三、Arduino 变量和常量 和C完全一样; 四、Arduino 运算符 和C完全一样; 五、Arduino 控制语句 注意其中一个:(三元运算符) ? :条件运算符语法 expression1 ? expression2 : expression3 max = ( a > b ) ? a : b; 六、Arduino 循环 和C完全一样 七、Arduino 函数 和C完全一样 注意:如果函数写在loop函数下面,则需要在前面声明,就像C语言里写在main函数下面一样 八、Arduino 字符串 Arduino字符串同样继承了C字符串的特点😭😭😭 char my

Clear input data from serial port in boost::asio

余生颓废 提交于 2020-01-11 06:43:10
问题 I'm writing a C++ program for communicating with a Arduino over a serial port using boost::asio. After establishing the connection the Arduino resets itself. However the input buffer of the C++ program still contains old data sent from the Arduino. Since I have no use for this data I'd like clear the input buffer. How can I accomplish that using boost::asio? My code currently looks like this: #include <boost/asio.hpp> #include <vector> #include <iostream> using namespace std; using namespace

Serial Receiving from Arduino to Raspberry Pi with PySerial stops after a while

牧云@^-^@ 提交于 2020-01-11 00:11:57
问题 I'm working on a project in which I have to receive some 25 character data at a time in order to process it in Raspberry Pi. Here is the example code that generates some data I want to receive from Arduino: char i =0; char a =0; char b=0; void setup(){ Serial.begin(9600); for(i=0;i<25;i++){ Serial.print('l');} Serial.print('\n'); delay(2000); } void loop(){ for(i=0;i<25;i++){ for(a=0;a<i;a++){ if((a==9)||(a==19)||(a==24)) Serial.print('l'); else Serial.print('d'); } for(b=0;b<25-i;b++){

Arduino官方推出两款H747板子,Portenta H7和Portenta Carrier

↘锁芯ラ 提交于 2020-01-10 04:15:26
这几天的CES2020上,Arduino亮相两款新板子。 Portenta H7 原理图和引脚图: Arduino-PortentaH7-schematic-V1.0.pdf Pinout-PortentaH7_v3.pdf 软件方面: 1、编程支持Arduino code, Python 和 JavaScript。 2、基于Mbed OS的Arduino框架。 3、原生支持Mbed API。 4、AI方面支持TensorFlow Lite。 规格: 板载了WIFI和蓝牙5.1二合一模块 板子效果: 引脚图,做的太漂亮了 高配版:Arduino Portenta Carrier 当前网上曝光出来的资料比较少。 1、带千兆以太网。 2、带USB,CAN,音频,相机,DisplayPort等接口。 3、带NBIoT,LoRa。 4、带miniPCI接口,可以外接Google的AI模块Coral。 来源: CSDN 作者: Simon223 链接: https://blog.csdn.net/Simon223/article/details/103890723

Arduino yun to parse.com

家住魔仙堡 提交于 2020-01-07 07:47:20
问题 I am trying to post an object to my parse.com app from my arduino yun and it needs to post a new object every second. So far I have been able to post every 10 seconds but I cannot seem to get the arduino to post any faster than that. I tried looking into the parse library but don't see what would be slowing it down. I am using the parse library given in the guide at https://www.parse.com/docs/arduino/guide. here is the code I have so far. #include <Parse.h> #include <Bridge.h> #include

arduino leonardo not recognized by usb cable in windows 8 pc

半腔热情 提交于 2020-01-07 06:52:26
问题 Actually the arduino leonardo working properly but from last 2 hrs when I connect it to my pc through usb cable it is telling something like usb is not recognized and even in device manager it is not showing. When I press restart button in arduino it will detect as arduino leonardo bootloader(com 7) but after few seconds it dissappears. What have I already tried to do: restart pc changed usb cable but the same issue. I checked usb by connecting other devices it works fine but the arduino is

How to find specific Teensy in COM list

独自空忆成欢 提交于 2020-01-07 04:38:10
问题 I am new to this so my first project is making a Skype notification cube from a TeensyLC and some LEDs. I know I can hard-code the COM port for communications but if I unplug it and use a different plug my COM port changes. I'd like to be able to plug the board in and have the software find it automatically. [Edit] It looks like I didn't express myself well the first time, so let me try this again. If I call SerialPort.GetPortNames() I get an array of {"COM1", "COM2", "COM3"}. If I make a new

那些你不知道运用Javascript能做出的惊人技术

非 Y 不嫁゛ 提交于 2020-01-07 01:18:09
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 自2009年Node.js问世以来,JavaScript的用途便不再局限于编写浏览器脚本,Node.js使它可以在服务端运行。不知是不是受到Node.js的启发,如今有很多技术拓展了JavaScript的用途,JS的新鲜玩法有很多,本文将给大家介绍其中最酷的5个惊人技术。 一、JavaScript控制机器人   最近越来越多的开发者开始折腾硬件,使用类似Arduino这样的单片机开发板来设计机器人。有很多JavaScript社区热衷于机器人的制作,贡献了很多不错的技术。Nodebots就是其中之一。它举办了很多汇集了全世界各地开发者的集会,便于他们交流经验、互相学习,共同探索更酷的玩法。 二、JS控制无人机   如果机器人不是你的菜,但是热衷于用JavaScript来控制现实世界的东西的话,那么你可能会对NodeCopter感兴趣。NodeCopter是一个开发者的集会,汇集了多个热衷于Parrot 2.0无人机的开发者团体。用JavaScript来控制无人机并不难,只需要在NPM里下载ar-drone包,编写几行代码,你的无人机就可以上天啦。 三、虚拟现实   虚拟现实这么酷的技术也能用JavaScript来实现?当然!你可能觉得设计出适用于VR的3D图像非常复杂,实则不然。开源框架A