Serial.println(code);
}
digitalWrite(EnPin,HIGH);
delay(500);
}
}
}"> Serial.println(code);
}
digitalWrite(EnPin,HIGH);
delay(500);
}
}
}"> Serial.println(code);
}
digitalWrite(EnPin,HIGH);
delay(500);
}
}
}">
Every time I try to bring softwareserial into my code I get this error:

In function 'void setup()':
error: expected unqualified-id before '.' token

I've searched the forum and references and cann't figure out what I'm doing wrong. thanks


my code looks like this:
#include <SoftwareSerial.h>



int val = 0;
char code [10];
int byteread = 0;
int EnPin = 2;

void setup()
{
Serial.begin(2400);
pinMode(2,OUTPUT);
SoftwareSerial(7,8);
SoftwareSerial.begin(9600);

}

void loop()
{

digitalWrite(EnPin,LOW);
if (Serial.available()>0)
{
if((val = Serial.read()) == 10)
{
byteread=0;
while (byteread < 10)
{
if (Serial.available()>0)
{
val = Serial.read();
if ((val == 10) || (val == 13))
{
break;
}
code[byteread]=val;
byteread++;
}
}
if (byteread==10)
{
Serial.print("Tag code is ");
Serial.println(code);
}
digitalWrite(EnPin,HIGH);
delay(500);
}
}
}


JLCPCB – Prototype 10 PCBs for $2 (For Any Color)

China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir