Using Tx/Rx pins simultaneously as data and clock pins, respectively

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)
    
  }

What exactly is the problem you are trying to solve?

BTW... you should probably be using the comparison operator (==) in the statements below...

Well... I looked at the serial documentation and found that you can really only send one byte at a time. I want to be able to send multiple bytes at a time with one command.

There is nothing stopping you from sending multiple bytes... ?

Serial.println("abcde") sends multiple bytes. They are sent one after the other, but that's what you would expect isn't it?

BTW... I have found the maximum reliable baud rate for Software Serial is 38400.

Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.