IP Addressing program, Newbie needs help.

Hi All,

I’m really hoping you guys can help me out. I have done programming before, but industrial so mainly PLC’s etc.

I’ve done minimal with C programming formats etc.

Problem I’m getting is with a program I’ve picked up on the net for changing an IP on a SainSmart relay board.

In the Void Loop area is stating that a variable is not declared in the scope and can’t see why.

I have attached an image of the program, which is very very small, if anyone could point me in the right direction, I really would be very grateful.

Thanks folks,

Stu

SED37:
I have attached an image of the program, which is very very small, if anyone could point me in the right direction, I really would be very grateful.

How to use this forum - please read

An image of text is really useless. Why don't you copy and paste it here? Use code tags.

your board does not have Serial1. or you didn't select the right board in the IDE menu

Thank you for your replies so far.

I have looking in the Arduino tuition areas and it’s suggesting that the line where I’m having issues (Serial1) is not being declared within that scope or section of the program, but I can’t see how my serial is either.

Program was written for an Arduino Uno, I’m using an Arduino Uno SMD Edition.

I’ve pasted the program in below (cheers for the link Delta_G Nice one)

/*
  Software serial multple serial test
 */

#include <SoftwareSerial.h>
#include <string.h> 


void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  // Start each software serial port;
  Serial1.begin(57600);
}

void loop()
{  
  unsigned char k,i;

  while (Serial1.available() > 0)
  {
    k = char(Serial1.read());
    Serial.write(k);
  }
  while (Serial.available() > 0)
  {
    i = char(Serial.read());
   Serial1.write(i);
  }
}

I’m still trying but running out of Options.

Will check Board selection in IDE also.

Uno doesn't have Serial1. how is the relay board connected to Uno?

Hi,

The program was written for an Uno but the board does look different to mine in the youtube video I'm trying to follow.

If you like the link to view is here:- https://www.youtube.com/watch?v=hT78mp7ApK0

Its to reprogram the IP of the controller module for the relay board, using the serial port utility tool on my pc.

its using the GND and 3.3v from the uno to power the control interface and the TX and RX pins crossed over to the control interface to program both the port number and the IP.

Actually finding it really interesting, got lots of ideas for the arduino now.

once I'm a little more up to date with how to use them lol.

Why are you including SoftwareSerial, but not creating an instance of that class? It appears that you are supposed to be creating an instance called Serial1.

Relay boards don't have IP addresses, so it is impossible to tell what you are really trying to do.

PaulS:
Why are you including SoftwareSerial, but not creating an instance of that class? It appears that you are supposed to be creating an instance called Serial1.

Relay boards don't have IP addresses, so it is impossible to tell what you are really trying to do.

Hi, it's not my program and as mentioned above I'm new to this style of programing. So I'm looking for guidance if possible.

Also mentioned above is that it's the controller interface I'm trying to change the ip on and not the relay board.

It's a sainsmart 16ch ethernet relay board I'm trying to use for a project I'm on. This comprises of the relay board and a daughter board which is the communication / ethernet board.

You did not mention if you had gotten past this Serial1 problem. You don't have one and need to create a SoftwareSerial instance and give it a couple of pins. No sign of the IP changing you mentioned initially.

Hi,
No I'm afraid I'm still stuck.

The YouTube video/tutorial I'm working from useschool the rx and tx pins to communicate with the module to change the IP so what I'm thinking is I should create an instance for this?

The Arduino is a go between from what I can gather, a coms protocol for the pc go via when using a program on my pc to change the IP on the sainsmart module.

To be honest it's got me clearly stumped

and why you can't change the IP address using the web client of the ethernet module?