how to change readUnsigned from storing numbers to storing letters


void readstring(char str[], char len) {
    char index = 0;
   while (index < len-1)
   {
      // if waiting read
      while (serial.available()== 0){}
      {
         char c = serial.read();
         // press enter
         if (c == '\r')
         {
            break;
         }

         else
         {
            //stores characters array
            str[index] = c;
            //adds index 1 characters
            //ensures when character pressed,
            //the character visible in serial-mon instead of 0
            index += 1;
            serial.print(c);
         }
      }
   }
   //marks end of string.
   str[index] = '\0';
}   
uint8_t readunsigned() {
      //an array store 8bit integars
      char str[8];
      readstring(str,8);
      //returns integar
      return atol(str);
   }

what receiving , trying store?
give example.

/mogens


Arduino Forum > Using Arduino > Programming Questions > how to change readUnsigned from storing numbers to storing letters


arduino

Comments

Popular posts from this blog

Installation database is corrupt

Nogen der kender et simpelt hvidt template med topmenu kun - Joomla! Forum - community, help and support

Error compiling for board Arduino/Genuino Uno.