Hi guys,
I am using a software to communicate with Arduino via wireless. My problem is that it is sending such characters:
ÿ &
ÿ ¥
ÿ û
So i downloaded a program that reads the serial com ports and this is what it shows:
Since you're sending characters that are NOT part of the ascii character set, they have been sent with unicode encoding. The FF is a BOM byte that tells you the next bytes are unicode. The fact that there's just one 255 tells you it's 16 bit. So the next 2 bytes represent the unicode character of the character you want.
I'd suggest that you ignore the 255 and just concentrate on the last two bytes being sent.
If you store your bytes within an unsigned int, you could then just shift your int variable and add the current char to get the value of the last two bytes. Checking this against 0x326 and 0x4a5 will detect the characters you're after.
Hello thankyou for your reply. Can you please give me an example code. I'm quite new to arduino. The parts:
FF 01 03 26
FF 01 04 A5
FF 01 05 FB
Where generated by my com port reading software.The program is sending:
ÿ &
ÿ ¥
ÿ û
unsigned int character=0;
void loop()
{
byte single;
if(Serial.available())
{single=Serial.read();
character<<8;
character += single;
switch(character)
{
case 0x0326://put your ÿ..& code below this line
break;
case 0x4A5://put your ÿ..¥ code below this line
break;
case 0X5FB: // PUT YOUR ÿ..û CODE below this line
}
}
}
The software is pyro ignition control. It is supposed to send data which will fire a cue in a firing system i am building. Any help is really appreciated because i have been trying to make it work for weeks now.
Ok, so i switched the software to rf32. And this is what the com reader is showing.
ÿÈFFF11FF11001 ÿÉFFF11FF10001†
ÿÈFFF11FF11001 ÿÉFFF11FF10010
Any ideas what is happening?
void setup()
{
Serial1.begin(9600);
pinMode(13,OUTPUT);
pinMode(14,OUTPUT);
pinMode(15,OUTPUT);
digitalWrite(13,LOW);
}
unsigned int character=0;
void loop()
{
byte single;
if(Serial1.available())
{single=Serial1.read();
delay(10);
character<<8;
character += single;
switch(character)
{
case 0x0326://put your ÿ..& code below this line
digitalWrite(13,HIGH);
break;
case 0x4A5://put your ÿ..¥ code below this line
digitalWrite(14,HIGH);
break;
case 0X5FB: // PUT YOUR ÿ..û CODE below this line
digitalWrite(15,HIGH);
}
}
}
RyanArduino:
Byte 1: Startbyte (255)
Byte 2: Slave ID (1-99)
Byte 3: Cue Nr. (1-99)
Byte 4: Checksum
I suspect that Byte 4 is a Cyclic Redundancy Check (CRC). If it were a simple checksum the small changes in the message would not result in such large changes to the sum.
Since this is working with EXPLOSIVES you may want to add code to check the CRC and Slave ID before acting on the message.
OK so there is absolutely no ASCII going on here, the title of the thread is a nonsense. The dots are just where the computer is trying to show a non printing character.
Ok, so i am going to give you all i know about the software and data. The software is pyro ignition control and it plays music while outputting serial data from the com port. the outputs are the cues one after the other. It has quite a number of output modes, but i wish to use rs32 one. Now the serial data with the rs 32 plugin is as follows:
ÿÈFFF11FF11001 ÿÉFFF11FF10001†
ÿÈFFF11FF11001 ÿÉFFF11FF10010
Any help would be a great deed to me. Regards Ryan.
I'm not sure what the rs32 plugin is, but it looks trivial to process the data that you gave in the original post except for the last byte that John suggests to be a CRC. Do you have a link to any documentation for the software you're using?