0

I have connected a bluetooth module(HC-06) and a voice recognition shield(EasyVR) on an arduino UNO.

By using an another HC-06 on the another arduino(so, 2 arduinos and 2 HC-06 totally), I am going to let two arduionos communicate with each other.

Also, simultaneously, one arduino with HC-06 will recogize the voice by using the voice recognition module.

I have successed each operations, but after combining two codes the bluetooth doesn't work... (Voice recognition have successed.)

  1. Is it unable to operate two operations simultaneously?

  2. Can we use these two sentences in one code?

    SoftwareSerial BT(2,3); --> for bluetooth module SoftwareSerial Port(12,13); --> for voice recognition module

1

Is it unable to operate two operations simultaneously?

The only way you can do two operations simultaneously is to have two Arduinos. An Arduino can only do one thing at a time. In order to make it seem like it's doing things at once you have to create your sketch accordingly. The use of delay() is right out. As are long loops using things like while(). In short: anything that blocks is bad.

Can we use these two sentences in one code?

Not reliably, no. They are both resource hungry and, to a large extent, blocking. A general rule is, if you need at least two more UARTs than the board provides then you need a different board. You can only reliably work with one software UART at a time.

I would suggest upgrading to a more capable board with more hardware UARTs. Either that or use a bluetooth system that doesn't use UART, such as an SPI based BLE module.

0

Physically It is impossible to run 2 things at the same time when you have one microcontroller. "The Arduino is a very simple processor with no operating system and can only run one program at a time". But I am pretty sure that the solution you are trying to find, hides in multitasking or interuption. There are some cones in delay() function: "The problem is that delay() is a "busy wait" that monopolizes the processor. " But in multitasking, you share clock of the processor between two different pieces. You can find more about running different things simultanously here. I have used miles() in one of my projects where were coin validator which was outputing impulses and screen which was showing chash inside it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.