Questions tagged [char]
9 questions
1
vote
1 answer
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 fixed length data types I want to pass back to…
LesRhorer
- 115
- 8
1
vote
1 answer
Assign a list of char *
Explain in a simple example. How to pass a char* to a function?
#define name1 "ABCD"
#define name2 "EFGH"
#define name3 "HIJK"
char *list[3] = {};
void printList(char *l, int x) {
for (int i = 0; i < x; i++) {
Serial.println(l[i]);
…
guyd
- 1,049
- 2
- 26
- 61
0
votes
1 answer
How can I make this function take up less memory?
I've written a sketch that uses TimeLib to display elapsed time. I'm measuring how long it takes to drain a battery. The goal is to display the time as hh:mm:ss.
The code I use works well when I create a sketch that only contains this code.
But when…
Hobbes
- 146
- 1
- 4
0
votes
1 answer
Problem saving "char" variable to EEPROM on ESP32
I am making a project, in which I need to store the WiFi credentials to the EEPROM. For now, I am able to store a bool array in the EEPROM, but I am not able to store the char variables as the ESP32 crashes. I can't share the complete code since it…
Loic Daigle
- 115
- 3
0
votes
1 answer
Construct Strings with UTF-8 characters from data
I am printing some ASCII art to the Serial monitor from Arduino UNO, with some success. However, using string literals uses more memory than I would like. I wanted to try constructing the strings/chars from other data types so that I can manipulate…
Hubert B
- 71
- 9
0
votes
2 answers
Problem cleaning string read from serial buffer
I am trying to move a stepper motor when a specific command is send to Arduino Mega 2560. This command is read character by character and stored in a string variable. Whenever a new command is sent, an act should be performed. However, it is not…
Yan Araújo
- 3
- 2
0
votes
1 answer
char * variable - Handle correctly to avoid overflow
I'm trying to understand if a char * variable can be updated down the code (since it only stores a pointer) or over-flow can occur.
For example:
char *A="/file.txt";
char *B;
void print_filename(char…
guyd
- 1,049
- 2
- 26
- 61
0
votes
1 answer
pointing to array of chars
I'm trying to pass a list of files (located in sketch) to be read using a library I write. List can have different filenames and vary in number of files.
How to pass a this array to my library?
for example:
char *parameterFiles[3] =…
guyd
- 1,049
- 2
- 26
- 61
-1
votes
2 answers
Char array filling with blanks
When I run this code, my pin and pinCheck arrays are not being filled with the results of keypad.getKey(). If I print the value at each index, the result is blank. As far as I can tell, I am either not writing a char to the array, I am misreading…
Ryan
- 3
- 2