Hello People.
Been a newbe to all this I have some how manged to get so far with my project but have hit a total blank about adding a RS232 output into my Sketch. This is my sketch so far and I wounder if any one could help me with the next bit.
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1115 ads1(0x48); /* Use this for the 16-bit version */
Adafruit_ADS1115 ads2(0x49);
char * format5(int x)
{
static char buffer[6]; // 5 chars + terminating NUL
snprintf(buffer, sizeof buffer, "%5d", x);
return buffer;
}
void setup() {
Serial.begin(9600);
ads1.setGain(GAIN_TWO); // 2x gain +/- 2.048V 1 bit = 1mV
ads2.setGain(GAIN_TWO); // 2x gain +/- 2.048V 1 bit = 1mV
ads1.begin();
ads2.begin();
}
void loop(){
int16_t results01,results02,results03;
results01 = ads1.readADC_Differential_2_3(); // x pin 1-2
results02 = ads1.readADC_Differential_0_1(); // y pin 3-4
results03 = ads2.readADC_Differential_2_3(); // z pin 5-6
Serial.print("X ");
Serial.print(format5(results01 * 0.0625)); // CP cell 1 to remote
Serial.print(" Y ");
Serial.print(format5(results02 * 0.0625)); // Field Gradient cell 1 to cell 2
Serial.print(" Z ");
Serial.println(format5(results03 * 0.0625)); // Contact CP Tip to cell 1
Serial.println();
delay(500);
i am trying to add the following and change it some how.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
mySerial.println("Hello, world?");
}
void loop() { // run over and over
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
Thanks for and advice
Joe