Skip to main content

Questions tagged [struct]

Refers to a basic data structure (also called record).

Filter by
Sorted by
Tagged with
0 votes
1 answer
125 views

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 ...
Noel's user avatar
  • 163
-1 votes
1 answer
40 views

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 ...
Darkmagister's user avatar
0 votes
0 answers
55 views

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 ...
Brian's user avatar
  • 11
1 vote
1 answer
522 views

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{...
Ethan Braun's user avatar
1 vote
0 answers
1k views

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....
brad's user avatar
  • 201
2 votes
2 answers
2k views

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 ...
albert's user avatar
  • 205
1 vote
2 answers
458 views

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 ...
guyd's user avatar
  • 1,049
3 votes
0 answers
23 views

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 ...
Dariem Fabián Hidalgo Arias's user avatar
2 votes
2 answers
11k views

Suppose that one defined a data structure and wanted to send it through serial. struct Gyro_data_structure { char command_name[5]; float gyro_X; float gyro_Y; float gyro_Z; }; ...
ShoutOutAndCalculate's user avatar
0 votes
1 answer
572 views

I got the below code generated this amazing tool. const size_t capacity = JSON_ARRAY_SIZE(2) + JSON_OBJECT_SIZE(1) + JSON_OBJECT_SIZE(4) + 2*JSON_OBJECT_SIZE(7); DynamicJsonDocument doc(capacity); ...
Anum Sheraz's user avatar
-1 votes
2 answers
185 views

I am working on a project where I have to build an IR program that works with all of the AVR/Arduino boards to control the IR devices such as TV, DVD, etc. I am building a struct that can carry the ...
Alex Zhuravel's user avatar
0 votes
2 answers
97 views

I haven't needed classes before in programming for Arduino, but I now have a good use case. I'm not sure I grasp how this will affect code space, though. Currently I have a struct that holds the ...
Jim Mack's user avatar
  • 269
0 votes
1 answer
93 views

For a project, I need to store an array of structures in PROGMEM. Array MessageTable[] will be composed of about ten struct InMessage elements. InMessage looks sort of like this: struct AvcInMessage {...
Bo Thompson's user avatar
0 votes
1 answer
58 views

In my sketch I have the following: #define HU_ADDR 0x190; #define ALL_AUDIO_ADDR 0x1FF; #define MY_ADDR 0x360; #define UNKNOWN_ADDR 0xFFF; typedef ...
Bo Thompson's user avatar
1 vote
2 answers
1k views

I am trying to learn more about arduino programming, and recently i've written functions for randomizing and then modifying a single array. Now i'd like to do the same for four individual arrays. This ...
Erik's user avatar
  • 271
0 votes
1 answer
3k views

I have declared a struct with some variables that right now are fixed, but one of the variables on the struct needs to be what the Arduino's serial port reads. struct testing_var { const char *...
Luz A's user avatar
  • 69
0 votes
1 answer
889 views

Consider this function: void noteOn(uint8_t pitch) { midiEventPacket_t noteOn = {0x09, 0x90 | 9, pitch, 127}; MidiUSB.sendMIDI(noteOn); } midiEventPacket_t is defined as: typedef struct { ...
Jonathan S. Fisher's user avatar
1 vote
1 answer
6k views

I made a struct like this: typedef struct { int color[3]; int positions[4]; char init[20]; void (*fn)(); } buttons; and a variable like this: button test[1] = { {{0,0,0},{0,0,100,100},"...
onlygio's user avatar
  • 13
1 vote
2 answers
5k views

I am a newbie in C and I can not understand the point of using a structure in C. Could someone explain to me what is the point of defining a structure in C programming? For example, this code(written ...
Jack's user avatar
  • 143
2 votes
4 answers
10k views

Using two boards of similar architecture I would like to send the contents of a struct from the sending board to the receiving board. I am using UART to transfer. My plan was to populate an array ...
Womble's user avatar
  • 199
0 votes
1 answer
2k views

I've been working with the lovely I2C_Anything.h (thanks to the great work and support from Nick over at http://www.gammon.com.au/forum/?id=10896&reply=9#reply9).. All working great, I was using ...
Andology's user avatar
5 votes
2 answers
12k views

I am hitting the limits of my arduino's SRAM and found that SRAM usage can be reduced by storing static stuff in flash memory instead of SRAM. My project can (optionally) be built with an included ...
Alex's user avatar
  • 181
22 votes
5 answers
79k views

C on embedded systems has traditionally use structs to hold structured data. Arduino brings C++ to the table, so we can use classes instead. Lets say we have two different data structures which ...
Cybergibbons's user avatar
  • 5,430