Questions tagged [struct]
Refers to a basic data structure (also called record).
46 questions
0
votes
1
answer
124
views
Serialise a struct containing a flexible array
I want to serialise and deserialise a struct containing a flexible array.
I did find a working code but wondering if it is the most elegant and optimum way to do it.
This is my first attempt below ...
1
vote
1
answer
227
views
How do I convert a structure to a char[] for use in Wire.h, or is there a better way?
I need to interface an ATTiny88 MCU configured as an I²C slave with a Raspberry Pi configured as an I²C master. I may be using the wrong approach, but I have a structure consisting of four different ...
-1
votes
1
answer
40
views
manage some output based on some parameter and rtc
i'm trying to create a program that given a configuration (i've used multiple struct nested) i need in loop() to check for each output if they need to be on or off and set the output accordingly
let ...
0
votes
1
answer
264
views
Doest a local struct variable get destroyed?
For a RF project I need to split payload for a max predefined chunk size.
For that I created a RFmsg struct.
The unexplained part I need help in is why when I create a local instance of RFmsg, its ...
0
votes
0
answers
55
views
I'm looking for the StreamSend.h library for use in Arduino/ESP8266 serial communications using struct [duplicate]
I've come across an interesting yet old article within StackExchange which has great examples of sending structured variables over serial communications. The library StreamSend.h and it's source code ...
9
votes
5
answers
2k
views
Same structure taking different memory space on Uno and NodeMCU ESP8266, leading to data corruption when transferring via nRF24L01+
I'm trying to transfer data between a Arduino Uno board to a NodeMCU ESP8266 board, using nRF24L01+ transceivers module and RF24 library on both side. The data I'm transferring are stored in a struct ...
1
vote
1
answer
522
views
Trouble initializing a struct array
The goal for this is to create a struct that includes a name, ID, fileName, and a boolean, then create an array of that structs.
Here's what I came up with:
struct Amiibo
{
char *aName{};
char *ID{...
1
vote
1
answer
76
views
Elements excluded from buffer array output after given structure (ESP8266 WifiSniffer) (snifferPacket)
I am currently trying to determine how the ESP8266 WifiSniffer program by Kalanda works.
Here is the source code:
#include <Arduino.h>
extern "C" {
#include <user_interface.h>
...
1
vote
0
answers
1k
views
incompatible types in assignment of 'const String' to 'char [32] using server.arg
I am trying to create a class and getting getting the error
incompatible types in assignment of 'const String' to 'char [32]
when I declare
char inString[32];
and try to set it as
inString = server....
4
votes
2
answers
18k
views
Initializing Array of structs
I defined myself a struct:
typedef struct {
unsigned char current;
unsigned char start;
unsigned char target;
unsigned long startTime;
unsigned int duration;
} led;
I was able to initialize ...
2
votes
2
answers
2k
views
Own type definition using a struct does not name a type
I need to initialize several buttons and LEDs connected to my Arduino. To store data related to an individual button or LED, I decided to define my own data type using two different structs. One for a ...
3
votes
3
answers
7k
views
How to get the sizeof array of structs
I'm trying to make a use of a relay module,
I want a clear way to configure and control my relay module
I've defined the struct and filled it with some info about id, pin number, title, and relay ...
1
vote
2
answers
457
views
Accessing struct's variable parametrically on ESP8266
I have 2 instances of a struct. One has def values stored and second stores values read from a file on SPIFFS.
I'm trying to use a for loop over all struct's variables - if file was read OK and key ...
0
votes
1
answer
511
views
Assigning value to a struct byte order
So i have struct:
typedef struct sendPacketStruct {
byte header = headerByte;//0x55
unsigned int time;//2 bytes
int height;//2 bytes
};
And i do this:
sendPacketStruct sendPacket;
...
3
votes
0
answers
23
views
How to properly pass struct as argument? [duplicate]
This is my first question! i'm sorry if i'm doing something wrong.
I'm trying to write a code that blinks some leds, but i cant quite work out how to use structs as arguments.
This is the code:
void ...