Hi.
I'm very confused about the Serial.printf
command in this Sketch:
void setup() {
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);
//set the resolution to 12 bits (0-4096)
analogReadResolution(12);
}
void loop() {
// read the analog / millivolts value for pin 2:
int analogValue = analogRead(32);
int analogVolts = analogReadMilliVolts(32);
// print out the values you read:
Serial.printf("ADC analog value = %d\n",analogValue);
Serial.printf("ADC millivolts value = %d\n",analogVolts);
delay(1000); // delay in between reads for clear read from serial
I dont't know:
- Why is used
Serial.printf
instead of serial.print ? - What means
%d\n
? - Finally, what advantages I have using
Serial.printf
?
I hope I've been ckear.
Any idea?
Thanks in advance