Created
June 1, 2012 22:01
-
-
Save jmccrohan/2855407 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static float sensor1 = 99.99; | |
static int sensor2 = 88; | |
static int sensor3 = 77; | |
static char sprintfbuffer[15]; | |
static char dtostrfbuffer[6]; | |
static char mergedbuffer[15]; | |
void setup() { | |
dtostrf(sensor1,5, 2, dtostrfbuffer); | |
sprintf(sprintfbuffer, "%i,%i", sensor2, sensor3); | |
memcpy(mergedbuffer, dtostrfbuffer, 5); | |
*(mergedbuffer+5) = ','; | |
memcpy(mergedbuffer+6, sprintfbuffer, 10); | |
Serial.begin(9600); | |
Serial.print("sprintfbuffer: "); | |
Serial.println(sprintfbuffer); | |
Serial.print("dtostrfbuffer: "); | |
Serial.println(dtostrfbuffer); | |
Serial.print("mergedbuffer: "); | |
Serial.println(mergedbuffer); | |
} | |
void loop(){ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment