Hello everyone,
I am trying to create a coin changing machine that will have multiple functionalities, one of each is dispensing a card if the user introduces a certain amount of money.
I have managed to establish communication between the bill validation and Arduino, but now I am having a difficult time figuring out how to communicate with the card dispenser.
I am using a CRT-541. Manual can be found here - page 15 - Multi Unit Communication Setting.(Model that uses RS232 interface).
I have connected the RX, TX and GND to the Arduino via jumper cables.
RX to Digital Pin 0, TX to Digital Pin 1 and GND to GND.
The multi switch is set to address '15' as per data sheet. Also, I am using an Arduino UNO R3 ATMega328P.
I have tried to communicate with the Arduino using following code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1);
char STX,HByte,LByte,HCmd,LCmd,ETX,BCC;
void setup() {
Serial.begin(9600);
STX = 0x02;
HByte = '1';
LByte = '5';
HCmd = 0x44;
LCmd = 0x43;
ETX = 0x03;
BCC = STX ^ HByte ^ LByte ^ HCmd ^ LCmd ^ ETX;
mySerial.write(STX);
mySerial.write(HByte);
mySerial.write(LByte);
mySerial.write(HCmd);
mySerial.write(LCmd);
mySerial.write(ETX);
mySerial.write(BCC);
}
void loop() {
}
I have never used RS232 to communicate to a device before so, I am sorry in advance if this is a stupid question, but I really don't have any idea on how I should manage the situation. I have tried to search on the internet before but I haven't found anything useful. Do you guys have any idea how I should fix the problem?
Thank you all again for the time reading this question