Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4923

Unused variable when it is used as the return value [Solved]

$
0
0
[Arduino]
The function below generates a warning "warning: variable 'OK' set but not used ". It is only a warning but I would like to understand why, and to eliminate the warning if possible.
Code:
bool HC12SetBaud(enum HC12Baud Baud)
{
  uint16_t BaudRate;
  char BaudCommand[11];
  bool OK = false;
   
  switch(Baud)
  {
    case Baud1200:
      BaudRate = 1200;
      break;
    case Baud2400:
      BaudRate = 2400;
      break;
    case Baud4800:
      BaudRate = 4800;
      break...
Unused variable when it is used as the return value [Solved]

Viewing all articles
Browse latest Browse all 4923

Trending Articles