About Programming codes errors

I’m trying to communicate with cs5490 cirrus integrated. When I write under codes I got these errors as below. Please help and check what could was my problem reason.

int resetpin = 7 ;
SoftwareSerial mySerial(0, 1); //RX ve TX

void setup() {

Serial.begin(9600);

mySerial.begin(600);

pinMode(resetpin, OUTPUT);

digitalWrite(resetpin, HIGH);

delay(2000);

digitalWrite(resetpin, LOW);

}

void loop() {

if(Serial.available() > 0){

Serial.write(0x8000);

Serial.print(“register kod =”);

okunankod = Serial.read();

Serial.println(okunankod);

delay(5000);

}
}

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: “Arduino Mega 2560 or Mega ADK”
sketch_dec15a:2: error: ‘SoftwareSerial’ does not name a type
sketch_dec15a.ino: In function ‘void setup()’:
sketch_dec15a:8: error: ‘mySerial’ was not declared in this scope
sketch_dec15a.ino: In function ‘void loop()’:
sketch_dec15a:28: error: ‘okunankod’ was not declared in this scope

Hello and welcome,

Always look the first error and solve it.

In your case you simply forgot to #include the softwareserial library. You also didn't declare variable okunankod (as the error tells).

Edit, also why use the SoftwareSerial library if you are going to use it on the HardwareSerial pins?

Also, to get the maximum responses from readers of this Forum, please read Nick Gammon's rules for posting here.

Make up your mind whether you want to use hardware or SoftwareSerial to do the communication. Using SS may be a good idea because it allows you to print debugging information on the Serial monitor but you cannot use pins 0 and 1 for SS.

Hi,

I gave actually to variable as '' okunankod = Serial.read(); '' could you kindly show how can i declare it else?

I looked into exapmles on arduino website. I would like to represent to my pins.

I also would like to represent baud rate as 600. This is the reason why i used these codes.

I'm using arduino ADK model. So it is represented on model RX and Tx pins as 1,0 pins.

#include <SoftwareSerial.h>

Ok Thanks you I solved that problem with that code. But still have problem about declaring okunan kod

okunankod = Serial.read();``error: 'okunankod' was not declared in this scope
Well, where is it declared?

The ADK got 4 HardwareSerial ports, you do not need the SoftwareSerial library, just do

Serial.begin( 600 ); // RX 0, TX 1
//or
Serial1.begin( 600 ); // RX 19, TX 18
//or
Serial2.begin( 600 ); // RX 17, TX 16
...

About the other error, you have to declare your variable, by giving it a type, for example:

char okunankod = Serial.read(); // read one character

okay many thanks. I got it now.

codes okay. But now i'm taking timeout error. Why it could be do like that?

Wrong / no board selected / connected?
Post the error code.

Board selected as ADK model. codes okay. Circuit as i see okay. there are three lights on arduino. one of is

'L'. Others as 'RX' and 'TX' lights. When i upload. Firstly 'L' is on. then suddenly off. others blinking and off. a few seconds these three off. Then L is on again. 3 times repeating it. Then im taking timeout error

In most cases, you cannot have something wired on RX0 / TX0 while uploading program to board, so either disconnect your device temporarily, or use another one of the 3 remaining Serial ports

problem was (0,1) pins. but now i cannot use serial monitors. Because of baud rate.

I could not choose 600 on serial monitor

Use an alternative serial monitor, Termite for example :wink:

karakocemre_18:
problem was (0,1) pins. but now i cannot use serial monitors. Because of baud rate.

I could not choose 600 on serial monitor

Why do you want to use 600 baud to communicate with the Serial monitor ?

Hi again,

I think something mistake on my serial communication. Because there is no reply.I used these code below

and use termite for serial communication. But nothing coming :astonished: please kindly help

#include "Arduino.h"

int okunankod;
int resetpin = 7 ;

void setup() {

Serial1.begin(600);

pinMode(resetpin, OUTPUT);

digitalWrite(resetpin, HIGH);

delay(2000);

digitalWrite(resetpin, LOW);

}

void loop() {

Serial.print("okunankod =");

if(Serial.available() > 0){

Serial.write(0x8000);

Serial.print("register kod =");

okunankod = Serial.read();

Serial.println(okunankod);

delay(5000);

}
}

Serial1.begin(600);
...
Serial.print("register kod =");

See the problem?

haaa okayy :slight_smile: many thanks :slight_smile:

But still has problem i corrected all as below;

#include "Arduino.h"

int okunankod;
int resetpin = 7 ;

void setup() {

Serial1.begin(600);

pinMode(resetpin, OUTPUT);

digitalWrite(resetpin, HIGH);

delay(2000);

digitalWrite(resetpin, LOW);

}

void loop() {

Serial1.print("okunankod =");

if(Serial1.available() > 0){

Serial1.write(0x8000);

Serial1.print("register kod =");

okunankod = Serial1.read();

Serial1.println(okunankod);

delay(5000);

}
}