Results 1 to 3 of 3

Thread: [MuIn LCD] bug with command speaker and print message to LCD

  1. #1

    [MuIn LCD] bug with command speaker and print message to LCD

    Hi,

    it seem is there a bug with command
    Speaker commands

    Plays a tone

    Command: 0xFE 0x73 [freq] [time]

    freq: value between 0 and 255
    time: value between 0 and 255

    and print to lcd.

    on the following code when i use speaker command and i print a message in LCD, the message doesn't appear, only "e" appear:
    Code:
    void setup()
    {
      Serial2.begin(57600);
      clear();
      move(1,1);
      playtone(50,100);
      printmsg("Test playtone");   
    }
    
    void loop()
    {
     
    }
    
    void clear()
    {
      Serial2.write(0xFE);
      Serial2.write(0x58);
      delay(5);
    }
    
    
    
    void printmsg(char *msg)
    {
      Serial2.print(msg);
      
    }
    
    void move(int row, int col)
    {
      Serial2.write(0xFE);
      Serial2.write(0x47);
      Serial2.write(row); 
      Serial2.write(col);
      delay(5);
    }
    
    void playtone(byte freq, byte time)
    {
      Serial2.write(0xFE);
      Serial2.write(0x73);
      Serial2.write(freq); 
      Serial2.write(time);
      delay(5);
    }
    When i comment command speaker, the message is printed to LCD it work

    Code:
    void setup()
    {
      Serial2.begin(57600);
      clear();
      move(1,1);
     // playtone(50,100);  //Command speaker commented
      printmsg("Test playtone");   
    }
    
    void loop()
    {
     
    }
    
    void clear()
    {
      Serial2.write(0xFE);
      Serial2.write(0x58);
      delay(5);
    }
    
    
    
    void printmsg(char *msg)
    {
      Serial2.print(msg);
      
    }
    
    void move(int row, int col)
    {
      Serial2.write(0xFE);
      Serial2.write(0x47);
      Serial2.write(row); 
      Serial2.write(col);
      delay(5);
    }
    
    void playtone(byte freq, byte time)
    {
      Serial2.write(0xFE);
      Serial2.write(0x73);
      Serial2.write(freq); 
      Serial2.write(time);
      delay(5);
    }
    If i put command speaker after a print message to LCD is a same it don't work.

    any idea ?
    Last edited by andromeda; 16-12-10 at 00:44.

  2. #2
    It is not a bug, since all the hardware timer of the MCU are already committed to other functions the speaker is managed by a software polling.
    For the duration of the sound is not possible to send new commands/characters to MuIn.

    After a beep command enter a delay period equal to that of sound.

  3. #3
    Yes with delay(200) after speaker command, the test is printed to LCD.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •