Hello,
I have this project that involves Bill Acceptor and Arduino. Whenever I insert a bill, it instantly displays the bill Ive inserted (e.g. insert 500 bill, arduino displays 500). I just have a little problem in this project. I want to add the total bills (example, first bill inserted is 500, then another 500 bill is inserted, it should display 1000). Do you guys know what command to use? this is my code BTW. I got it from Pyramid Apex 5000 Bill Acceptor + Arduino Uno - YouTube. Thanks for the video, I really really find it very useful.
//Pyramid Technologies APEX Series 5000 Bill Acceptor
//Arduino Library
//By Jesse Campbell, www.jbcse.com
//Configuration info: Imgur: The magic of the Internet, http://i.imgur.com/b6b0SuH.jpg
//2014-11-15
#include <ReceiveOnlySoftwareSerial.h>
//http://gammon.com.au/Arduino/ReceiveOnlySoftwareSerial.zip
#define PIN_TTL_RX 10 //Green wire, Transmit data line from acceptor
#define PIN_INTERRUPT_LINE 4 //orange wire on APEX, Request send data to host
#define PIN_SEND_LINE 5 //white/blue wire, host ready signal
ReceiveOnlySoftwareSerial mySerial(PIN_TTL_RX); //RX
struct codeMap{
int code;
String description;
};
const int codeCount = 13;
codeMap codes[codeCount];
void setup()
{
Serial.begin(115200);
while (!Serial) { } //wait for Serial to be available
//set the data rate for the ReceiveOnlySoftwareSerial port
mySerial.begin(600);
digitalWrite(PIN_TTL_RX, HIGH); //internal pull up required
codes[0].code = 0x81;
codes[0].description = "20 Pesos Credit";
codes[1].code = 0x82;
codes[1].description = "50 Pesos Credit";
codes[2].code = 0x83;
codes[2].description = "100 Pesos Credit";
codes[3].code = 0x84;
codes[3].description = "200 Pesos Credit";
codes[4].code = 0x85;
codes[4].description = "500 Pesos Credit";
codes[5].code = 0x86;
codes[5].description = "1000 Pesos Credit";
codes[6].code = 0x87;
codes[6].description = "1 Credit";
codes[7].code = 0x88;
codes[7].description = "Reserved";
codes[8].code = 0x89;
codes[8].description = "Vend";
codes[9].code = 0x8A;
codes[9].description = "Return";
codes[10].code = 0x8B;
codes[10].description = "Reject";
codes[11].code = 0x8C;
codes[11].description = "Failure";
codes[12].code = 0x8D;
codes[12].description = "Full or Jam";
pinMode(PIN_INTERRUPT_LINE, INPUT);
pinMode(PIN_SEND_LINE, OUTPUT);
}
void loop() //run over and over again
{
if (digitalRead(PIN_INTERRUPT_LINE) == LOW){
digitalWrite(PIN_SEND_LINE, LOW);
digitalWrite(PIN_SEND_LINE, HIGH);
}
long start = millis();
while(millis() < start+5)
if (mySerial.available()){
int codeFromBillAcceptor = mySerial.read();
//Serial.println(codeFromBillAcceptor, HEX);
for(int i=0; i<codeCount; i++)
if (codes*.code == codeFromBillAcceptor){*
-
//Serial.print(millis());*
_ Serial.println(codes*.description);_
_ }_
_ }_
_}*_