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);
}
}
}
[url=http://www.theengineeringprojects.com/2017/01/use-arduino-software-serial.html]HOW TO USE ARDUINO SOFTWARE SERIAL ?