arduino

UDP Connect Always Succeeds

只愿长相守 提交于 2019-12-11 15:38:18
问题 I am using Boost ASIO to connect to an Arduino Nano with an Ethernet Shield over ethernet. This is the Arduino setup: #include <EtherCard.h> ether.staticSetup("10.0.0.4", "10.0.0.1"); ether.udpServerListenOnPort(&callback_function, 1337); This is my C++ code that connects to it: Header #include <boost/asio.hpp> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> #include <boost/bind.hpp> #include <boost/thread.hpp> #include <boost/system/error_code.hpp> #include <boost/system

Maximize Arduino serial output

给你一囗甜甜゛ 提交于 2019-12-11 13:47:41
问题 There are a multiple questions intersperced throughout this post. Kindly read carefully and answer the pieces you can for an upvote. Use Case Create a time series csv file of pressure reads. These reads need to be of maximum frequency, but I only need it to last less than 10 seconds or so. Material Arduino Uno Clone (unalterable) serial over USB 2.0 (alterable) pyserial (Python 3) SSD Problem Identify and fix the bottleneck preventing frequency from maximum reads/s. The code Arduino void

Strange behavior when compiler converts from float to double

家住魔仙堡 提交于 2019-12-11 13:43:15
问题 I have an array: float foo[3]; In the ino file I have to send one of them to the PID as input. double output; PID myPID(&input, &output, &target, 1, 0.0, 1.1, DIRECT); ... void loop(){ input =foo[2]; myPID.Compute(); Serial.print(output); //output: "nan" ... } The PID is as follow: PID::PID(double* Input, double* Output, double* Setpoint, double Kp, double Ki, double Kd, int ControllerDirection) It compiles but the output of the PID outvalue is nan. However if I set the input to -1.2 then it

cylon.js & arduino uno: execute program without cable connection to PC

萝らか妹 提交于 2019-12-11 13:37:30
问题 I am new to this field, so this might be an odd question. We can write a code(say blinking lights) in the aduino IDE and upload it to arduino and we can disconnect from the pc and the program will run. (blinking will happen). Now when we are using cylon.js and write the program and execute say $ node blinking.js then as long as the arduino is connected to the pc(or laptop) the blinking happens and when I kill node js or disconnect arduino from pc the blinking stops. (this is how its suppose

How to print response to AT commands in Arduino serial port?

心已入冬 提交于 2019-12-11 12:38:29
问题 I want to print the response to AT command. I'm sending AT command but I'm not getting any response in the Arduino serial port. It's giving -1 instead of OK. #include "SoftwareSerial.h" String ssid = "connectify-krish"; String password = "12345678"; String myword= ""; SoftwareSerial esp(10, 11); void setup() { Serial.begin(9600); esp.begin(9600); esp.write("AT"); Serial.println(esp.read()); } void loop() {} 回答1: As already pointed out in the comments you are not terminating the AT command

Arduino: cannot pass union struct as pointer ac I can with gcc compiler

我怕爱的太早我们不能终老 提交于 2019-12-11 12:32:38
问题 I'm trying to use structs with Arduino but cannot pass a struct pointer with a function call. Everything works fine when adding a main function and compiling for my computer with gcc but with the Arduino IDE I get errors. The code I tried was: typedef union { struct { unsigned unit :2; unsigned channel:2; unsigned status :1; unsigned group :1; unsigned remote :26; }; unsigned long data; } Signal; Signal signal; void testPassingStruct(Signal *variable) { variable->status = 1; } void setup() {

Arduino Sensor 10DOF MPU9255 cannot fetch magnetometer data

时间秒杀一切 提交于 2019-12-11 11:59:31
问题 I'm using a 10 DOF IMU with an MPU9255 and a BMP180 to collect orientation data. When I run a sketch for arduino that I downloaded to test the IMU's capabilities, it collects the data from the accelerometer and gyroscope elements perfectly, but is stuck with requesting the data from the magnetometer, which it never receives. It reads the magnetometer data succesfully once, but then can never read it again unless I re-upload the program. More specifically, the bitwise and never evaluates to

Pass an integer to an Arduino

て烟熏妆下的殇ゞ 提交于 2019-12-11 11:46:56
问题 I am having some trouble passing over integers to the Arduino that is not a 1 or a 0. In this example I want to be able to pass a 3. The reason is that I will soon have more buttons controlling different parts of the Arduino and will need different integer values to do this. Here is Arduino code.. void setup() { Serial.begin(9600); // Define the led pin as output pinMode(13, OUTPUT); } void loop() { // Read data from serial communication if (Serial.available() > 0) { int b = Serial.read(); //

Serial communication between pc and arduino via RS232 using c++

 ̄綄美尐妖づ 提交于 2019-12-11 11:41:09
问题 I am trying to communicate with my arduino duemilanove via an RS232 cord. I simply want to be able to send a byte (or char) to my arduino from a desktop application. The Arduino is plugging into USB COM5 on my computer. I have the RS232 plugged into COM1, and then I have pins 2 3 and 5 on the other end of the RS232 connected to arduino pins TX, RX, and GND, respectively. I found a serial comm class for c++ at the following link: http://playground.arduino.cc/Interfacing/CPPWindows I have added

Arduino not sending integers properly

徘徊边缘 提交于 2019-12-11 11:01:31
问题 I am trying to send integers 0 through 10 from my Arduino Uno to my Android device. However, the Arduino is not sending the integers separately, but rather it is sending it as a cluster (sometimes 2 at a time). I want to be able to send an integer every 5 milliseconds and not delay any longer than that. Any ideas? Arduino code: #include <SoftwareSerial.h> const int RX_PIN = 8; const int TX_PIN = 9; SoftwareSerial bluetooth(RX_PIN, TX_PIN); char commandChar; void setup (){ bluetooth.begin