Barcode issues
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
Hello
I've bought the barcode module and plug it to arduino mega 2560 to dfrobot (19)
Everything is fine, except that the output is like this : UXZg^y
Do you have an idea ?
Another question is: is there a way to switch-on the barcode reader (without clicking the button) via Arduino code and TX ?
Thanks a lot
I've bought the barcode module and plug it to arduino mega 2560 to dfrobot (19)
Everything is fine, except that the output is like this : UXZg^y
Do you have an idea ?
Another question is: is there a way to switch-on the barcode reader (without clicking the button) via Arduino code and TX ?
Thanks a lot
Code: Select all
String code = ""; //initialize the output string
boolean endbit = 0; //a flag to mark 0D received
char temp;
void setup() {
Serial1.begin(9600); //initialize the Serial port
Serial.begin(9600); //initialize the Serial port
Serial.println("hello");
}
void loop() {
if (Serial1.available() > 0) {
temp = char( Serial1.read()); //read the input data
Serial.println("TEMP:"+code);
code += temp;
if (temp == 0x0D || temp == '\r'){ // Or temp == '\r'
Serial.println("CODE:"+code);
code = "";
endbit = 0;
temp = 0;
}
}
}
![icon](images/icon_file.png)
![icon](images/icon_file.png)
2018-08-16 01:27:54 what the fuck is that connection ? do you use a max232 or so componant for voltage conversion ? I seriously doubt so according to your pic. this componant has RS232 output, which if you're doing what I think according to the photo is reading a -9V signal instead of +5V and +9V instead of 0. So if you're actually doing what I think you're not only reading an inverted signal (you read 0s instead of 1s and 1s instead of 0s) but also overvoltaging your arduino board with serious risks of ruining it. You cannot read directly the output of the 9pin connector, you have to convert voltages first from RS232 (-9 - +9) to TTL level (0 - 5).
ankou29666
no idea, there's CTS and RTS pins on the schematics, you may try that (with the same RS232 levels as far as I remember) but I doubt about it, their purpose is about flow control, to indicate to each other they are ready for receiving data (Clear To Send) or they have data so send (Ready to Send)
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)