Hello,
I am working on a project in which i can't use pins 0 and 1 for RX and TX.
After browsing online I found several sources stating that you can use analog pins as RX and TX.
Initial code used tx=0 and rx=1
#include <SoftwareSerial.h>
int tx=0;
int rx=1;
SoftwareSerial bluetooth(tx, rx);
void setup(){
bluetooth.begin(9600);
pinMode(tx, OUTPUT);
pinMode(rx, INPUT);
}
void loop(){
}
Since i need those pins I tried initializing pins A0 and A1 as RX and TX.
#include <SoftwareSerial.h>
int tx=0;
int rx=1;
SoftwareSerial bluetooth(tx, rx);
void setup(){
bluetooth.begin(9600);
pinMode(tx, OUTPUT);
pinMode(rx, INPUT);
}
void loop(){
}
This didn't work, but when I tried switching back to the initial code it didn't work anymore.
Can someone tell me what may have been wrong with my code?
And why doesn't my old code (that worked before) work anymore?
Thank you in advance for helping me out ![]()
Sabre