Questions tagged [convert]
Change data from one format to another.
58 questions
-1
votes
1
answer
58
views
How to get recover numeric data sent by an Arduino in binary
I am a C# dev and these C++ data conversions are killing me.
I have an Arduino sending binary data through LoRaWAN to AzureIOT. I am trying to decode my Temp/Humid/Bat payload that I am pulling out of ...
0
votes
1
answer
69
views
Make my Arduino (Mega or whatever is better for the task) to be able to read and write `Serial` data to a **rj45** port
I have a Chinese hybrid solar inverter that exposes an rj45 input which talks the serial protocol (Baud rate 2400, no parity, 8 bits, 1 stop bit). I need my Arduino (say, Mega or whatever, does not ...
1
vote
1
answer
1k
views
Parse char* mac-string to uint8_t array
I have to handle a String coming in over UART containing a bunch of information, part of it is a MAC-address that I get by using String.substring(a, b) returning a 12-char String representing a mac-...
3
votes
1
answer
584
views
How do I use a transmitter and receiver to send string messages conditionally to a receiver?
I'm working on a project to build a plant monitor that works from the outside with Arduino that picks up light and water values from it's environment then uses a nRF24L01 with an antenna and I've come ...
0
votes
0
answers
157
views
Arduino RS485 do I need MAX485?
I'm trying to connect sesnor that use RS485 (I'm almost sure that's modbus). The sensor has RX/TX and +/- wires. Do I still need a component between the RX/TX pin from the Arduino UNO and the sensor ...
1
vote
1
answer
302
views
float miscalculation when int32_t variable is divided by 10 [duplicate]
i want to ask, how to get correct float value from uint32_t or long variable is devided by 10??
long var3 = 1139399025;
int a = 3;
int b = 10;
void setup() {
Serial.begin(9600);
Serial.println((...
1
vote
2
answers
2k
views
Converting 16bit to float
I am trying to communicate with AT30TS75A-MA8M-T with below code, the problem is converting the 16 bit output to float so I can read temp:
Base on data sheet
I suppose to remove first 5 bit in order ...
0
votes
1
answer
1k
views
String to unsigned 16-bit integer
I'm currently working on a project with a 4DSystems Display. Im talking to the Display over SoftwareSerial with an ESP32. As soon as I want to use a Unicode character it requires me to convert my ...
1
vote
1
answer
1k
views
How to convert serialized JSON string back to JSON object?
How to convert JSON String for example
{"f0":100,"f1":100,"f2":100}
It is what I get from my esp01 side from I2C communication
Now I want it to get it back to my Arduino ...
1
vote
0
answers
143
views
How to use 5v and 12v addressable led strip together
Hi guys I’m new to this forum and also not much experience about led lights question already asked but didn’t get any detailed answer I want to know can I provide working data signal to 2 different 5v ...
0
votes
2
answers
203
views
How to use float data from a sensor with the Arduino mouse library
I'm using a gyroscope, which returns angular velocity in floats. I'm trying to use this data with the arduino mouse library. The move function requires a signed character. I'm not what the best way is ...
3
votes
1
answer
686
views
Programmatically-adjustable buck converter module?
LM2596 is easy to use and cheap, but I have to adjust the output voltage using a screw driver. On the web, there was a "hack" that someone posted, but that hack does not seem as clean or ...
0
votes
2
answers
877
views
Float to int conversion not working right in method using varargs
I am trying to convert a floating point number to an integer, but it seems like the conversion is not working properly.
I am using the math library to calculate the power of 10 based on the number of ...
2
votes
1
answer
394
views
Converting from Float to Int yielding weird results. What am I doing wrong?
So I am trying to take GPS data with a Neo 6M gpsmodule (that is what is covered up by the square for privacy sake) and process it by adding/multiplying to get large integers representing the GPS data....
0
votes
2
answers
441
views
Convert character to Integer while leaving encoded
I have two characters, that I get by Bluetooth.
char a = SerialBT.read();
char b = SerialBT.read();
According to the Arduino Reference, decoded data stored in a char gets encoded to ASCII text.
I ...
0
votes
0
answers
463
views
Tapered log potentiometer to linear formula
I have a tapered log 10K potentiometer. I would like some function which returns tapered log value to linear values.
The potentiometer is a slider. When connected to the Arduino the wiper displays the ...
1
vote
0
answers
84
views
RFID RC522 Serial Communication converting problem
I am new to the RFID Scene and Serial communication as well.
So I am trying to use the RC522 RFID module and I wrote in block 22 - 0x36 which is 6. I want to write a code where I take whatever is in ...
-1
votes
1
answer
1k
views
Reading bmp images from SD card, converting it and displaying it on serial monitor in Arduino
Can someone please help me write code that can read a 24-bit BMP file from an SD card, save converted to 8-bit BMP internally, and display the 8-bit BMP pixel values on Arduino terminal as a 2D matrix....
1
vote
1
answer
469
views
How to split a *char and pass to a function needing uint8_t?
I have a requirement where an event has char *newvalue.
void event(char *newValue) {
//Code here
}
newValue is 2 digits. If it's 1-9 it is " 1" " 2" and 10+ is "10" "11" etc. It also can contain ...
1
vote
1
answer
1k
views
cast double to long leads to unexpected results
I wrote a little program to show my problem:
void setup()
{
Serial.begin(9600);
double K=39.85;
double a=K*100;
Serial.print("a= ");
Serial.println(a);
long val_long = 0;
val_long = ...
1
vote
0
answers
289
views
Converting string to byte array and byte array to string?
I am trying to create a string message and then encrypt it via AES but the example only accepts byte array as input. How can I convert fullmessage string to message byte array to encrypt it? Checked ...
1
vote
0
answers
160
views
8266 get uint8_t PROGMEM array from uploaded file
I'm new programming arduino. I have connected an Adafruit thermal printer to an ESP8266 board.
I've the example code for use the board like a webserver that allow upload files. What i want is to ...
0
votes
1
answer
1k
views
Need function to convert bool array to int- why doesnt this work?
Hey I wrote this function to convert an bool array to int:
(Math Lob included):
bool b_array[5];
int convertToInt(start_index,stop_index){
int run=0;
int result=0;
for(int id=start_index;...
1
vote
2
answers
5k
views
Converting human readable date to a unix timestamp [duplicate]
Can anyone provide a sample code that would convert a human readable date like 2019-10-27 22:10:35 to a unix timestamp like 1572214235?
I found many topics about it, but they eider refer to out of ...
0
votes
1
answer
163
views
How to merge two GPS coordinates without losing decimals
I want to take the GPS coordinates like 42.1234 per 22.1234 and merge them as a string, with a separator character:
42.1234 x 22.1234
But using this code:
gps_string = (String)gps.location.lat()+' ...
2
votes
2
answers
2k
views
How to convert char[12] to byte[6]
I am trying to convert a char[12] array that contains a Mac Address into a byte[6] in order to use within the Ethernet.begin method. I have tried various methods from online, but had little success to ...
5
votes
4
answers
19k
views
Convert String to IPAddress
How can i convert a String to IPAddress on arduino / esp ?
etc. "192.168.1.2" -> IPAddress(192, 168, 1, 2)
Tried this
void setup() {
Serial.begin(115200);
IPAddress apip;
const char *...
-1
votes
2
answers
223
views
Arduino analogRead fluctuates from sensor unless USB connected
I have an Arduino connected to a 4-20 mA sensor through a current to voltage converter. When connected to the power supply the sensor reading fluctuates, as soon as I also connect it to a USB port it ...
2
votes
0
answers
92
views
Converting Client input char to int
I'm trying to print out the temperature from a DS18B20 sensor to my app via a tpc connection. Because I have two sensors connected I will need to call the one needed by an Index. This index comes from ...
4
votes
2
answers
21k
views
How to converte EPOCH time into time and date on Arduino?
I have a question on how to convert EPOCH timestamps, which I receive as char*, into DD.MM.YYYY and HH:MM:SS format separately?
Here is more information on my Arduino project: The Arduino is receiving ...
1
vote
1
answer
575
views
Assign and control Digital pin from String
Here is modified version of Blink example
#define D8 13
String p = "D8";
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin ...
3
votes
2
answers
22k
views
Problems on convert byte[] to String
I'm reading a RFID Card from RC522 and send the data to my computer. My problem is the conversion of byte[] to String or std::string.
#define SIZE_BUFFER 18
#define MAX_SIZE_BLOCK 16
byte ...
0
votes
1
answer
296
views
Posting TinyGPS++ co-ordinates as paramaters with GPRS
I'm able to view my co-ords on the Serial Monitor using Serial.println(gps.location.lat(), 6);
I believe the data type returned by gps.location.lat() is double. I need to pass this value to a ...
1
vote
2
answers
1k
views
Reconstruct uint32_t from char array to RTC.set
I am currently experimenting with a Digistump ATTiny85. Since it has no Serial, I use the basic DigiUSB library for communication. The RTC library used is this one: https://github.com/JChristensen/...
0
votes
2
answers
209
views
3.3V from 5.0v outlet
I am working with an Adafruit Feather 32u4 FONA board. I want to connect a GPS module I have worked with before (3.3V required) but am not having much luck. I have studied the pinout of the board and ...
1
vote
1
answer
16k
views
How to make I2C work on RS485?
I'm trying to optimize the communication (minimize wires) on a project where I can control a motor and toggle some 230V devices by using RS485 and I2C.
On this project, I'm using an Arduino (Mega) ...
2
votes
1
answer
1k
views
Arduino String: use a non-null-terminated char array?
I'm using a library that takes a String as it's parameter (https://github.com/gmag11/painlessMesh)
I want to pass char arrays that is binary (UTF-8) data that also contains null-bytes (0x00). Right ...
1
vote
1
answer
260
views
DS18B20 sending variable via Enthernet shield
I am trying to send temperature read from DS18B20 to a web server. I know two things: to read a temperature, and to send something to web server. What I don't know is how to convert float that ...
1
vote
1
answer
174
views
3.3V Conversion [closed]
I'm writing a SPI Master module for my FPGA and I would like test it with my Arduino Uno.
What's the problem? My FPGA has 3.3V logic and Arduino has 5V TTL logic.
So, what's the simplest solution to ...
1
vote
2
answers
3k
views
Conversion between boolean and int went wrong
I have a small problem with conversion from bool array to int. It is working fine until it comes to the 12th cycle of while. I don't know why but this is really weird.
I try to paste here a code ...
1
vote
3
answers
8k
views
How to use a coma as the decimal separator?
I have a LCD that displays a float variable. I would like to show a comma instead of a dot as the decimal separator.
float temp = 23.50;
lcd.setCursor(0, 0);
lcd.print(temp);
I want to show 23,50 ...
0
votes
1
answer
8k
views
String to unsigned long conversion
I'm trying to use strtoul() to convert an Arduino String to an unsigned long (like the return of millis();) using the following code snippet:
unsigned long foo (String time)
{
unsigned long mili;
...
0
votes
1
answer
628
views
Connecting Arduino to PC through Slimline SATA instead of USB?
I removed the DVD-RW from my laptop and want to use the new area as an IO port instead. There is an Arduino Nano with me which can fit into the emptied out drive space and there are some easy to ...
2
votes
1
answer
2k
views
How to understand the "power economy" of a voltage up-converter (boost converter)?
My online video Arduino instructor makes use of various devices to amplify signals, currents, and voltages. This seems like magic to me.
For instance, he has 4 AA batteries with 1.2V each. He says "...
1
vote
2
answers
3k
views
Connect Arduino Uno RX/TX to 3.3v NEO-M8N gps module
I'd like to connect an M8N gps module to an Arduino Uno. From what I understand
the Arduino pins 0-RX/1-TX work on 5V
the M8N RX/TX work on 3.3v
the sensor-TX sending to the Arduino-RX should work (...
0
votes
1
answer
2k
views
Converting array to char
I'm trying to convert a char array to a char. i used this code
char code[4] = {'1','2','3','4'};
char strcode[4];
void setup()
{
Serial.begin(9600);
}
void loop()
{
memcpy(strcode, code, 4)...
-3
votes
1
answer
66
views
Create an a message from two inputs[Programming Help] [closed]
I'm a bit new to this and I have the following function that I'm having trouble getting it to compile. The intent is to create a message to write out to a software serial port. Inputs are two int ...
0
votes
1
answer
7k
views
Hex String -> Byte Array -> Serial Write
I'm writing code that I discussed in a previous post. I now have a setup where I send my Arduino an ASCII-encoded Hex String that represents the bytes I want to write to my serial device. I think I've ...
-1
votes
2
answers
4k
views
ESP8266 - Parsing last char from a string
I'm trying to parse the last character from the string of the reply from server and print them to serial monitor.
My arduino code:
// This will send the request to the server
client.print(String("...
2
votes
1
answer
4k
views
Convert LIRC config file to Arduino IR remote command
I have a LED 24 button remote with a few broken buttons and I want to simulate all the buttons with an esp8266 using an IR remote library.
I would like to know if someone can help me translate the ...