Sure, here they are:
Code using hardware serial transmission:
byte msg[] = {
0x1E, 0x00, 0x0C, 0xD1, 0x00, 0x07, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x60, 0x00, 0x72, 0xD5 };
void setup() {
Serial.begin(115200);
delay(1000);
}
void loop() {
delay(7000);
Serial.println("Start");
// Initialise the F-bus
for (int z = 0; z < 128; z++) {
Serial.write(0x55);
}
delay(1000);
// Send our command
for (int x = 0; x < (sizeof(msg) / sizeof(byte)); x++) {
Serial.write(msg[x]);
}
// Wait for a reply
while (1) {
delay(1000);
while (Serial.available() > 0) {
char c = Serial.read();
Serial.print(c, HEX);
Serial.print(" ");
}
}
}
Code using software serial transmission:
#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin, true );
void setup() {
// define pin modes for tx, rx:
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// set the data rate for the SoftwareSerial port
mySerial.begin(115200);
// For user output messages
Serial.begin(115200);
}
void loop() {
// Initialise the F-bus
Serial.println("Initializing F-Bus.");
for (int z = 0; z < 128; z++) {
mySerial.write(0x55);
}
delay(1000);
// Send our command
Serial.println("Send request.");
byte msg[] = {0x1E, 0x00, 0x0C, 0xD1, 0x00, 0x07, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x60, 0x00, 0x72, 0xD5};
for (int x = 0; x < (sizeof(msg) / sizeof(byte)); x++) {
mySerial.write(msg[x]);
}
// Read answer
Serial.println("Read answer.");
mySerial.listen();
while (1) {
delay(1000);
while (mySerial.available()>0){
Serial.print(mySerial.read(), HEX);
Serial.print(' ');
}
}
}
All those were grabbed from previous links.