Advertisement
tsester

arduino: char vs short

Jul 22nd, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. void setup() {
  2.     /* initialize serial */
  3.     Serial.begin(115200);
  4.     Serial.println("Serial Begun!");
  5.     char test[]="19/10/32 43:23:54";
  6.     Serial << test << endl;
  7.     char data[6];
  8.     sscanf(test,"%hhd/%hhd/%hhd %hhd:%hhd:%hhd",&data[5],&data[4],&data[3],&data[2],&data[1],&data[0]);
  9.     for (int8_t i=0;i<6;i++)
  10.     {
  11.         Serial << _DEC(data[i]) << " | ";
  12.     }
  13.     Serial << endl;
  14.    
  15.     while(1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement