Hi,
When I use Wire and SoftwareSerial together things stop working (Duemilanove). I need to use the regular HW UART for comms with my PC, and therefore use SoftwareSerial to drive a Pololu servo serial microcontroller, and the Wire interface to get readings from a compass. Is it possible to use the Wire and SoftwareSerial together?
The setup code looks like this:
#include <SoftwareSerial.h>
#include <Wire.h>
#define rxPin 8
#define txPin 7
// HMC6352 compass
int addr = 0x42 >> 1;
int heading = 0;
// Servo
unsigned int pos = 3000;
SoftwareSerial swserial = SoftwareSerial(rxPin, txPin);
void setup()
{
Serial.begin(9600);
Wire.begin();
pinMode(48, OUTPUT);
digitalWrite(48, HIGH);
heading = 0;
// Servo
pinMode(rxPin, INPUT);
// Keep Pololu board from getting spurious signal
digitalWrite(txPin, HIGH);
pinMode(txPin, OUTPUT);
swserial.begin(9600);
Serial.flush();
}
If I comment this line out, then the Wire interface works.
//SoftwareSerial swserial = SoftwareSerial(rxPin, txPin);
Else the Wire interface doesn't work.
Any suggestions would be appreciated
Thanks