Hi guys,
I am pretty new to the arduino, and this is my first post... please be kind ![]()
Senario:
Arduino uno r3.
Small rs485 board (http://img.dxcdn.com/productimages/sku_163849_3.jpg)
Ducati Smart 96 Piu
With the code below I was able to send a correct packet request, I can tell because the power enalyzer displays the "Send" icon which it only does if it has been polled correct so I presume that is fine, however, I can't print the response from the analyzer.
I am still trying to figure it out... been at it for a while now, I decided to post on the hope that someone could point something out that I missed.
Any help is muchly appreciated!
Cheers,
Jared.
#include <SoftwareSerial.h>
#define rxPin 13
#define txPin 12
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
byte buf[] = { 31, 3, 0, 1, 0, 48, 23, 160 };
void setup() {
  Serial.begin(9600);
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  mySerial.begin(9600);
}
void loop() {
  mySerial.write(buf[0]);
  mySerial.write(buf[1]);
  mySerial.write(buf[2]);
  mySerial.write(buf[3]);
  mySerial.write(buf[4]);
  mySerial.write(buf[5]);
  mySerial.write(buf[6]);
  mySerial.write(buf[7]);
  delay(2000);
  Serial.println("Data from port:");
  while (mySerial.available()) {
    char inByte = mySerial.read();
    Serial.write("Data");
    Serial.print(inByte, HEX);
    delay(10);
  }
  Serial.println("");
 Â
}