Hello community!
I have a question regarding the buzzer on the Mbot Ranger.
I want to be able to set the buzzer to continuously play a tone whilst more code executes. This is akin to the motors where I can set the power of the motor to 50% for example, and the robot will move and be able to execute other lines of blocks/code.
In a bid to solve this issue, I first explored inside the Mblock 5 interface, the only parameters I could configure for the buzzer was frequency and delay. I do not want a delay, I just want to set a sound.
So I Googled how to use the buzzer using Arduino C and found
tone(pin, frequency, optional delay)
This is exactly what I am looking for as reading online suggested that it will allow the program to run without waiting on the buzzer.
I then went inside the Mblock 5 IDE and looked at compiled code of the sound codeblock. I found that
#include <SoftwareSerial.h>
#include <MeAuriga.h>
MeBuzzer buzzer;
was imported at the start of the script.
I looked into the buzzer methods and all I could find was:
void setup() {
buzzer.setpin(45);
}
and
buzzer.tone(65,0.25*1000);
delay(20);
The buzzer.tone() method is the same one as the code block and not like the tone() of the Google search Arduino. I cannot make the buzzer run in the background.
Does anyone have an idea for how I can make the buzzer run in the background whilst more code executes?