I’m programming an ATtiny to read pixels in from a camera and using SoftwareSerial to set the data transfer rate. The problem is SoftwareSerial uses way too much memory and it’s preventing my program from running properly. All I’m using it for is to set the data transfer rate so does anyone here know if there is another way of doing this:
#define FASTADC 1
// defines for setting and clearing register bits
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
SoftwareSerial mySerial(0,1) PROGMEM;
byte pixelsArray1; //Array to hold the values of the individual pixles.
byte pixelsArray2; //Array to hold the values of the individual pixles.
byte pixelsArray3; //Array to hold the values of the individual pixles.
// set prescale to 16
pinMode(1,OUTPUT); //Setting the 1 pin to be used for output
pinMode(0,OUTPUT); //Setting the 0 pin to be used for output
pinMode(A3,INPUT); //Input for Camera 3
pinMode(A2,INPUT); //Input for Camera 2
pinMode(A1,INPUT); //Input for Camera 1
mySerial.begin(9600); //Setting the data transfer rate
You don't seem to be using mySerial at all so why call it?
At the very end of the setup() method I am using it to set the data transfer rate with
That's why I want to use something besides SoftwareSerial, it's taking up too much space and I hardly use it.
I hardly use it.
You don't use it at all in the program that you posted. Mind you, the program does not have a loop() function so will not compile anyway.
Where is the rest of the program ?
I have a loop() and the rest of the program is in other methods. The reason I only shared that part is because the only place I am using SoftwarSerial is when setting the bit rate. Which is what I'm wondering about.
because the only place I am using SoftwarSerial is when setting the bit rate.
Setting the bit rate of what ? Do you use the mySerial object in your program ? If so then you are using SoftSerial in your program.
If you don't use mySerial in your loop then that line does not set any data transfer rate.
You know that the Serial object has an identical begin method right?
How are you transferring the data? Without knowing that there's no way to tell you how to set the rate.
When you don't know something and someone asks to see the rest of the code, it would be a good idea to go ahead and show them instead of arguing why you don't think it is necessary. Perhaps the person asking knows something you don't and maybe they know what they need to see to answer your question.