My C is fairly strong but C++ not so and I'm having trouble getting a pointer to a SoftwareSerial instance.
#include <SoftwareSerial.h>
SoftwareSerial mySs(10, 11);
*SoftwareSerial ss = mySs; //<===== error here
void setup() {
ss->begin(9600);
}
void loop() {
for (int i = 'A'; i < 'Z'; i++) {
ss->write (i);
}
ss->write ('\n');
delay(100);
}
expected constructor, destructor, or type conversion before 'ss'
Anybody know the correct syntax for this?
This is just a test prog, the pointer is required for a library function that needs to call the user-supplied object's write func.
Rob
Does this work...
#include <SoftwareSerial.h>
SoftwareSerial mySs(10, 11);
SoftwareSerial * ss = & mySs; //<===== error here
void setup() {
ss -> begin(9600);
}
void loop() {
for (int i = 'A'; i < 'Z'; i++) {
ss -> write (i);
}
ss -> write ('\n');
delay(100);
}
Thanks CB, that works a treat with the test prog.
I'll plug it into the main prog and see how it goes.
Rob
Doh, just looking at my code and see I had the * before the SoftwareSerial, that wouldn't have helped.
Anyway all working now.
Rob
Doh, just looking at my code and see I had the * before the SoftwareSerial, that wouldn't have helped.
Mistakes like that just put you in good company.
Anyway all working now.
Excellent!