Hi Everyone.
I have just started writing libraries for Arduino Uno. Finished writing a simple library to control L293D Motor Driver IC callled #include<Motor.h>
What i am trying to do next is include #include<SoftwareSerial.h> into #include<Motor.h> library.
/*
Bluetooth.h - Library for HC05 Bluetooth Module
Created by K.Raghavendran, September 23, 2016.
Released into the public domain.
*/
#ifndef Bluetooth_h
#define Bluetooth_h
#include "Arduino.h"
//#include <SoftwareSerial.h>
#include "\SoftwareSerial\SoftwareSerial.h"
class Bluetooth
{
public:
Bluetooth(int rx,int tx);
void Initialize();
void Connect();
private:
int _rx;
int _tx;
};
#endif
And now the CPP file.
/*
Motor.cpp - Library for L293D Motor Driver IC
Created by K.Raghavendran, September 21, 2016.
Released into the public domain.
*/
#include "Arduino.h"
#include "Bluetooth.h"
//#include <SoftwareSerial.h>
#include "\SoftwareSerial\SoftwareSerial.h"
Bluetooth::Bluetooth(int rx, int tx)
{
pinMode(rx, INPUT);
pinMode(tx, OUTPUT);
_rx = rx;
_tx = tx;
}
void Bluetooth::Initialize()
{
Bluetooth.begin(9600);
Serial.println("Bluetooth Test!");
}
void Bluetooth::Connect()
{
if (Bluetooth.available()){
BluetoothData=Bluetooth.read();
}
And finally the code i am trying to implement
#include <Bluetooth.h>
#include <SoftwareSerial.h>// import the serial library
#include <Motor.h>
//#include <\SoftwareSerial\SoftwareSerial.h>
SoftwareSerial Bluetooth(0, 1); // RX, TX
int BluetoothData; // the data given from Computer
// the setup function runs once when you press reset or power the board
Motor motor(2,3,4,5);
void setup()
{
Bluetooth.Initialize();
}
// the loop function runs over and over again forever
void loop()
{
Bluetooth.Connect();
if(BluetoothData=='1'){
motor.Forward();
Serial.print("StemBot Forward");
// if number 1 pressed ....
// move forward motor1 and 2
}
if (BluetoothData=='0'){// if number 0 pressed ....
motor.Backward();
Serial.print("StemBot Backward");
}
if (BluetoothData=='2'){// if number 0 pressed ....
motor.Stop();
Serial.print("Stop StemBot");
}
if(BluetoothData=='3'){ // if number 1 pressed ....
motor.Right();
Serial.print("StemBot Right Turn");
}
if (BluetoothData=='4'){// if number 0 pressed ....
motor.Left();
Serial.print("StemBot Left Turn");
}
if (BluetoothData=='2'){// if number 0 pressed ....
motor.Stop();
Serial.print("Stop StemBot");
}
delay(100);// prepare for next data ...
}
}
Now i get the error // C:\Program Files (x86)\Arduino\libraries\Bluetooth/Bluetooth.h:11:44: fatal error: \SoftwareSerial\SoftwareSerial.h: No such file or directory
#include "\SoftwareSerial\SoftwareSerial.h"
Thank you and regards,
K.Raghavendran