Hello I am trying to send hex values to serial then monitoring the response I get from a old current loop device.
This is my code:
void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
Serial.begin(4800,SERIAL_8E1);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10000);
byte inByte1 = 0xF1;
byte inByte2 = 0x10;
byte inByte3 = 0xB0;
Serial.write(inByte1);
Serial.write(inByte2);
Serial.write(inByte3);
delay(70);
byte inByte4 = 0xE1;
while (Serial.available()) {
byte inChar = Serial.read();
Serial.println(inChar);
if(inChar == inByte4)
{
digitalWrite(13, !digitalRead(13));
}
}
}
When I run this exact hex through a fdti usb device using my windows delphi program I get a response however when I run this through the nano I am using I get no response from the device.
I also get this in my serial monitor
ñ°ñ°ñ°ñ°
This is the result I get after 4 loops. I know that this is not a well formed question but if you can see anything that would result in the hex values being sent incorrectly please let me know.
I have now used a real program and integrated a usb to serial listener into my circuit. I am receiving the hex values perfectly F1 11 B0 E1 from my input of F1 11 B0 but when I try read those the serial buffer on the arduino is empty. Any suggestions