barcode scanner

Hey
I have bought Barcode Scanner Module, 1D/2D and programmed it. This scanner should control the servo motor.
When barcode scanners scan the barcode, if the third number is 8, the servo motor goes to 90degrees and comes back (to open the door). Although I have scanned the POR232 code, my scanner cannot scan the EAN code. So my servo motor does not work correctly. I have copied my codes here
Can someone help me to correct my codes?

#include "Servo.h"
#include "SoftwareSerial.h"
#include "SparkFun_DE2120_Arduino_Library.h"

SoftwareSerial softSerial(2, 3); //RX, TX: Connect Arduino pin 2 to scanner TX pin. Connect Arduino pin 3 to scanner RX pin.

DE2120 scanner;

#define BUFFER_LEN 40
char scanBuffer[BUFFER_LEN];

Servo myServo;

void setup()
{
myServo.attach(9);
Serial.begin(38400);
Serial.println("DE2120 Scanner");

if (scanner.begin(softSerial) == false)
{
Serial.println("Scanner did not respond. Please check wiring. Did you scan the POR232 barcode? Freezing...");
while (1)
;
}
Serial.println("Scanner online!");
}

void loop()
{
myServo.write(0);
if (scanner.readBarcode(scanBuffer, BUFFER_LEN))
{
Serial.println("Code found: ");
for (int i = 0; i < strlen(scanBuffer); i++)
Serial.println(scanBuffer*);*

  • Serial.println();*

  • myServo.write(90);*

  • delay(50000);*

  • myServo.write(0);*

  • }*

  • delay(200);*
    }

pegah-1991:
Hey
I have bought Barcode Scanner Module, 1D/2D and programmed it. This scanner should control the servo motor.
When barcode scanners scan the barcode, if the third number is 8, the servo motor goes to 90degrees and comes back (to open the door). Although I have scanned the POR232 code, my scanner cannot scan the EAN code. So my servo motor does not work correctly. I have copied my codes here
Can someone help me to correct my codes?

You just hijacked this topic. You need to start a new topic.

ToddL1962:
You just hijacked this topic. You need to start a new topic.

Please read the forum instructions on posting before you do.

@pegah-1991

TOPIC SPLIT
PLEASE DO NOT HIJACK / NECRO POST !

Could you take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Perhaps it is disabled by default? Try calling "scanner.enableAll1D();" and/or "scanner.enableAll2D();" after scanner.begin().

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.