Hello!
I am writing library for the HC-05 Bluetooth modle that is heavily dependant on the SoftwareSerial library. I came across a problem trying to seperate bytes and then transmit them. I found the shiftIn() function, and now I am wondering if I can use the Tx/Rx pins as the data and clock pins for that. (Tx as data and Rx as clock)
here is the code, so far:
#ifdef HelioHC05_h
#define HelioHCO5_h
#define maxSpeedBaud 57600
#include <SoftwareSerial.h>
#include "Arduino.h"
class HELIOHC05 {
public:
HELIOHC05(int TxPin, int RxPin);
void begin(long baudRate);
void sendPackage(size_t packageS, sizeof(size_t packageS));
void recievePackage(size_t packageR, sizeof(size_t packageR));
void checkConnStat(bool connState);
void checkIfBlockage(bool blockState);
void acknowlege();
void listen();
void speak();
void sendByte(byte bytePackS, sizeof(byte bytePackS));
void recieveByte(byte bytePackR, sizeof(byte bytePackR));
private:
int _TxPin;
int _RxPin;
long _baudRate;
size_t _packageS;
size_t _packageR;
bool _connState;
bool _blockState;
byte _bytePackS;
byte _bytePackR
};
#endif
HELIOHC05 :: HELIOHC05(int TxPin, int RxPin){
SoftwareSerial BLE(TxPin, RxPin);
_TxPin = TxPin;
_RxPin = RxPin;
}
HELIOHC05 :: begin(long baudRate){
BLE.begin(baudRate);
if (baudRate > maxBaudRate){
return NULL;
}
_baudRate = baudRate;
}
HELIOHC05 :: sendPackage(size_t packageS, sizeof(packageS)){
if (sizeof(packageS) = 1){
BLE.print(packageS);
}
if (sizeof(packageS) = 2){
}
}
void getByte(int numberOfByte){
pinMode(RxPin, OUTPUT);
byte highByte = shiftIn(TxPin)
}