Questions tagged [printf]

10 questions
3
votes
1 answer

Using pointers with Arduino

I am learning about pointers. I was wondering how the memory address is defined in programming. I get different outputs depending on the format I choose for memory address. So I was wondering if it is correct to assume that the format of the memory…
Jack
  • 143
  • 1
  • 2
  • 6
3
votes
1 answer

How to use printf with Arduino's serial ports without an intermediary buffer?

How to use printf with Arduino's streams without an intermediary buffer? The following seems unnecessary: char buf[256]; sprintf(buf, ...); Serial.print(buf); Is there a way to connect HardwareSerial or SoftwareSerial to a libc stream or is there a…
Ana
  • 470
  • 2
  • 7
  • 13
1
vote
1 answer

How to use a variable format in `sprintf`

How should I make a variable format sequence for sprintf?. int i=2,d=9; String sf; sprintf(sf,"%%0%d",i); fprintf(sf,d); While expecting the output. 09 The compilation fails, with several errors, according the failing change I apply. Invalid cast…
Brethlosze
  • 333
  • 3
  • 17
1
vote
2 answers

Porting the FastNoise c++ library to Due

I'm trying to use the FastNoise library with a Due, however, I get something like the following errors, when I try to complie. error: 'abs' was not declared in this scope error: 'mt19937' is not a member of 'std' error: 'uniform_int_distribution' is…
Gergo
  • 13
  • 2
1
vote
3 answers

formatting of IPAddress via printf(...) family similar to Serial Object

I am trying to use an sprintf with an IPAddress and I am not sure why Serial.print() is able to convert IPAddress to a reasonable human readable representation. I mean, presumably it uses an overloaded function that detects what type the parameter…
Octopus
  • 150
  • 2
  • 8
0
votes
1 answer

printf %s gives gibberish

This Code: String S0 = ""; String S1 = "1"; String S2 = "12"; String S3 = "123"; String S4 = "1234"; String S5 = "12345"; String S6 = "123456"; String S7 = "1234567"; String S8 = "12345678"; String S9 = "123456789"; String S10 = "1234567890"; String…
AKTanara
  • 163
  • 5
0
votes
2 answers

Strange behavior from uint32_t, acting like signed int (Nano clone)

I'm having trouble with these variables. As you can see they're uint32_t type, so they should have a maximum value of 4 million or so, but they're rolling over and going negative at 32,767 like a signed int. Here's the relevant code: byte lPin =…
HaLo2FrEeEk
  • 103
  • 3
0
votes
1 answer

Serial printf implementation

Based on this approach I wanted to implement a function for formatted printing data to the serial monitor. I tried the code below: int PIN = 12; void _printf(char *fmt, ...) { va_list va; va_start(va, fmt); char buf[vsnprintf(NULL, 0, fmt,…
pt12lol
  • 101
  • 1
  • 3
0
votes
2 answers

Using the Logging library, sometimes doesn't exit setup()

This has been a hard problem to diagnose, so I hope I'm giving enough info here. I'm trying to write a program for the Arduino (a lighting controller) using a bit of OO. There are several classes in my library, and some extend others. I'm a…
dj_segfault
  • 137
  • 8
0
votes
1 answer

AVR has no vprintf_P?

Well this was unexpected. AVR libc has many the variants of printf, including vprintf, but is missing vprintf_P. Is this really just not present or implemented elsewhere?
Ana
  • 470
  • 2
  • 7
  • 13