arduino

convert from hex to decimal Arduino

拜拜、爱过 提交于 2019-12-11 18:41:17
问题 I am extracting the weight of a Reach Stacker , for the moment this is my result : get data from ID: 18FFF227 2 1 F0 3C 0 0 1 0 what I need is to take F0 3C 0 0 and change it to 0 0 3C F0 then convert it to number to decimal. 003CF0 = 15600 according to this page: enter link description here this would be my number in decimal 15600 this my code : #include <SPI.h> #include "mcp_can.h" #include <SoftwareSerial.h> SoftwareSerial mySerial (3,2); // the cs pin of the version after v1.1 is default

Why won't this code play a converted wav2c header file through an arduino to my speaker?

旧街凉风 提交于 2019-12-11 17:09:38
问题 I used this converter wav2c to convert a .wav file to a C that I can put in a header file. I was able to put converted audio into the h file but the program where I reference it does not seem to be working correctly. The code compiles and uploads to the Arduino but no sound plays. I used the code here to implement the converted audio. I'm using an 8-ohm 0.25w speaker. I'm no programmer nor an expert at electronics so it's likely something dumb that I did wrong. Any help is much appreciated!

Parsing JSON code with ESP8266

*爱你&永不变心* 提交于 2019-12-11 17:08:37
问题 I'm testing a piece of code to see if I can parse the JSON code I'm receiving. I basically copied the code from: ArduinoJson/assistant So I've placed the received JSON string in a const char* to see if it works, but I get a weird response instead of a normal integer result. Does somebody know what is going on here? PS I know it's a huge response from the server, while I only need like 2 data's from. Here's my code: #include <ArduinoJson.h> void setup() { Serial.begin(115200); Serial.println(

Byte Order of Serial communication to Arduino

情到浓时终转凉″ 提交于 2019-12-11 16:45:00
问题 I am trying to write a C++ application to send a 64bit word to an Arduino. I used termios using the method described here The problem i am having is the byes are arriving at the arduino in least significant byte first. ie if a use (where serialword is a uint64_t) write(fp,(const void*)&serialWord, 8); the least significant bytes arrive at the arduino first. this is not the behavior i was wanted, is there a way to get the most significant byes to arrive first? Or is it best to brake the

How to dispose of unique_ptr?

跟風遠走 提交于 2019-12-11 16:42:43
问题 I was looking at some arduino code which said : std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure); Normally a unique pointer is created using make_unique. So I was wondering what I need to do to dispose of this pointer ? 回答1: You don't need to do anything. This code does almost the same thing as make_unique . I'd recommend you not to write code like this yourself ( make_unique is better), but if you can't change this line, you are unlikely to notice the

parse an API link message as a server in C (Arduino IDE)

亡梦爱人 提交于 2019-12-11 16:34:30
问题 I am using Arduino IDE to program my micro-controller which has a built-in Wi-Fi chip (ESP8266 NodeMCU) , it connects to my internet router and then has a specific IP (as like 192.168.1.5 ). So I want to send commands (and data) by a message which added to the link, then the link becomes as : 192.168.1.5/?A=data1&B=data2 . When link above is launched from a device within LAN, then I can get the message in a String variable, here I have now a message which contains "?A=data1&B=data2" . So the

Distance between bluetooth module and an android device

馋奶兔 提交于 2019-12-11 16:28:17
问题 I'm trying to calculate the distance between and android device and the HC-05 bluetooth module (connected to an arduino module: the MEGA 2560), using an android app created using appinventor. For example I'd like to know if the devices are 4 meters from each other so I can turn on an alarm. After doing some research it seems that is almost imposible to do, it seems that the most that can be done is estimate that distance constantly sensing the RSSI indicator. Is this possible? if not ,what

Int variable input error for static uint8_t array

我是研究僧i 提交于 2019-12-11 15:49:11
问题 This is an extension from Input process and type for static uint8_t array regarding issues experienced from the suggested solution. Currently, I am trying to create both a int variable and a string variable with is inputted into a static uint8_t array and then is printed using Serial.println . I am using: #include <U8x8lib.h> Int Variable Code (Has Error): int world = 1; static uint8_t hello[sizeof(world)]; memcpy(hello, &world, sizeof(hello)); If I copy this directly and paste it into the

Updating Label and Live Graph dynamically using Arduino Data in Tkinter

淺唱寂寞╮ 提交于 2019-12-11 15:44:16
问题 I've been working on a project that updates the label and plots it in a live graph that's coming from the Arduino. It outputs temperature and humidity. My arduino serial outputs looks like this: 29,50,44 I use this line of codes in separating the serial data in python: ser = serial.Serial('COM3',9600) pullData = ser.readline().decode('utf-8') get_data = pullData.split(',') I get to separate the values and update them in their respective labels. But what I don't get it to work is when I

how to pass memberfunction to member function of another class

女生的网名这么多〃 提交于 2019-12-11 15:43:29
问题 I'm writing a class to access global variables through string-input (serial, webinterface, telnet, etc.) on an esp32. Therefore my variableAccess class has an attribute representing the variables address and an enum specifying the datatype (to make it short only int and float are in the example code below). The variable can then be set/read by the setValue/readValue methods. During initialization the variableAccess objects are created and stored in a vector 'allVariables' Now for my problem: