when i use SoftPWMBegin()
function in setup there is some delay while receiving data over bluetooth. And if i pressed o and 1 fastly (see in below given code), some time it receives data and sometime not receives.
when i not using SoftPWMBegin()
it receives data fastly . I think SoftPWMBegin()
function creating some problem.
I want use SoftPWM.h
library for controlling RGB led brightness. So please give me any solution for that...
#include <"SoftwareSerial.h">
#include <"SoftPWM.h">
SoftwareSerial Genotronex(0, 1);
int redPin = A5;
int greenPin = 3;
int bluePin = A0;
int BluetoothData;
void setup()
{
Genotronex.begin(57600);
SoftPWMBegin();
}
void loop()
{
if (Genotronex.available())
{
BluetoothData=Genotronex.read();
if(BluetoothData=='0')
{
SoftPWMSet(redPin, 0);
}
else if(BluetoothData=='1')
{
SoftPWMSet(redPin, 20);
}
}
}