Connections to blynk cloud

Hello,

I have a problem with the connections , I will explane,

I have 2 arduino one with W5100 ethernet shields,
1 arduino with W5100 runs a sketch with reading 6 sensors DS18s20 and output to 4 relay card with I switch manual , I read and switch with the Blynk app on my iPhone 4 S with ios 9.3.2, thats runs a few months good

Now i bought a othetr arduino one with w5100 ethernet shield and write a sketch with reading two sensor and a relay board with 2 relay its almost the same sketch a s the other one

Now it will happen that the 2 W5100 the same mac adress and the same Ip adress that’s no good and it will conflict
now i changed the sketch by the 2 sensors in a static ip adres and it works
but now he read the sensors and then he contect again and read the sensors and so on, the connection will not stand What is wrong by my sketch?
I send the skech with it

This sketch allows you to send values of multiple DS18B20 sensors to your iOS or Android device.
You will need to use the other sketch to read the sensor numbers for later identification.
You need to fill in those numbers below.If you use less than seven sensors, delete the unused sections
or you will get “expected primary-expression before ‘?’ token” errors.
I thank all the people whose code I have adapted for their effords and making this sketck possible.

Blynk lets you create beautiful drag-and-drop visual interfaces
for your projects in 5 minutes. And it works with almost every
hardware out there.

Docs, Tutorials, everything: http://www.blynk.cc
Github: http://github.com/blynkkk
Blynk Community: http://community.blynk.cc
Follow Us: http://www.facebook.com/blynkapp
http://twitter.com/blynk_app

Blynk library is licensed under MIT license
This example code is in public domain.


You’ll need, in general:

  • Blynk App (download from AppStore or Google Play)
  • Arduino UNO or similar microcontroller board
  • Decide how to connect Arduino to the Internet (USB, Ethernet,
    Wi-Fi, etc.). Bluetooth is on the way.

There is a bunch of great example sketches included to show you how to get
started. Think of them as LEGO bricks and combine them as you wish.
For example, take the Ethernet Shield sketch and combine it with the
Servo example, or choose a USB sketch and add a code from SendData
example.


Let’s turn ON your LED with Blynk!
In this example we’ll use Arduino UNO + Ethernet Shield

5 Steps guide:
(watch video tutorial here: )

  1. Connect LED to Pin 4,5,6,7;
    ( http://arduino.cc/en/uploads/Tutorial/simplefade_bb.png )

In the Blynk App:
2. Create New Project
3. Email yourself Auth Token. You can do it later at any time
4. Add a Button Widget. Select Pin D9 in Widget’s Settings
5. Press Play icon. Enjoy Blynking!

********************************************************************/

#define BLYNK_PRINT Serial // Enables Serial Monitor
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h> // This part is for Ethernet stuff
#include <OneWire.h>

// OneWire DS18S20, DS18B20, DS1822 Temperature Example
//
// http://www.pjrc.com/teensy/td_libs_OneWire.html
//
// The DallasTemperature library can do all this work for you!
// http://milesburton.com/Dallas_Temperature_Control_Library

OneWire ds(8); // on pin 7 (a 4.7K resistor is necessary) make sure you change this from the original pin 10 to an unused pin.
int adr;
float s1;
float s2;

char auth[] = “97cf88c7145c4faeb39dd1b3a30a4628”; // Put your Auth Token here. (see Step 3 above)

//IPAddress server_ip (10, 0, 0, 10);

// Mac address should be different for each device in your LAN
byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress arduino_ip ( 192, 168, 0, 177);
IPAddress dns_ip ( 0, 0, 0, 0);
IPAddress gateway_ip ( 192, 168, 0, 1);
IPAddress subnet_mask(255, 255, 255, 0);

void setup()
{

Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth, “cloud.blynk.cc”, 8442, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
// Or like this:
//Blynk.begin(auth, “blynk-cloud.com”, 8442, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);

pinMode(3, OUTPUT);

pinMode(2, OUTPUT);

}

void loop()
{
Blynk.run(); // All the Blynk Magic happens here…

// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
byte i;
byte present = 0;
byte type_s;
byte data[12];
byte addr[8];
float celsius, fahrenheit;

if ( !ds.search(addr)) {
Serial.println(“No more addresses.”);
Serial.println();
ds.reset_search();
delay(200);
return;
}

// Serial.print(“ROM =”);
for( i = 0; i < 8; i++) { //we need to drop 8 bytes of data
}
adr = (addr[7]);

if (OneWire::crc8(addr, 7) != addr[7]) {
Serial.println(“CRC is not valid!”);
return;
}

Serial.println();
// the first ROM byte indicates which chip
switch (addr[0]) {
case 0x10:
Serial.println(" Chip = DS18S20"); // or old DS1820
type_s = 1;
break;
case 0x28:
Serial.println(" Chip = DS18B20");
type_s = 0;
break;
case 0x22:
Serial.println(" Chip = DS1822");
type_s = 0;
break;
default:
Serial.println(“Device is not a DS18x20 family device.”);
return;
}

ds.reset();
ds.select(addr);
ds.write(0x44, 1); // start conversion, with parasite power on at the end

present = ds.reset();
ds.select(addr);
ds.write(0xBE); // Read Scratchpad

delay(1000); // maybe 750ms is enough, maybe not
// we might do a ds.depower() here, but the reset will take care of it.

for ( i = 0; i < 9; i++) { // we need 9 bytes to drop off
data[i] = ds.read();
}
Serial.println();

// Convert the data to actual temperature
// because the result is a 16 bit signed integer, it should
// be stored to an “int16_t” type, which is always 16 bits
// even when compiled on a 32 bit processor.
int16_t raw = (data[1] << 8) | data[0];
if (type_s) {
raw = raw << 3; // 9 bit resolution default
if (data[7] == 0x10) {
// “count remain” gives full 12 bit resolution
raw = (raw & 0xFFF0) + 12 - data[6];
}
} else {
byte cfg = (data[4] & 0x60);
// at lower res, the low bits are undefined, so let’s zero them
if (cfg == 0x00) raw = raw & ~7; // 9 bit resolution, 93.75 ms
else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
//// default is 12 bit resolution, 750 ms conversion time
}
celsius = (float)raw / 16.0;
fahrenheit = celsius * 1.8 + 32.0;
if(adr == 36) { //replace ??? with value of sensor number 1
s1 = celsius; //change celsius to fahrenheit if you prefer output in Fahrenheit
}

if(adr == 122) { //replace ??? with value of sensor number 2
s2 = celsius; //change celsius to fahrenheit if you prefer output in Fahrenheit
}

for( i = 0; i < 50; i++) { //the 1000 is the amount of times the Blynk.run() runs in succession

Blynk.run(); // All the Blynk Magic happens here…

delay(100); //The delay to stop server flooding
}

Serial.print(" Sensor 1 = “);
Serial.print(s1);
Serial.print(” Sensor 2 = ");
Serial.print(s2);

Blynk.virtualWrite(V5, s1);
Blynk.virtualWrite(V6, s2);

}

is there nobody who can help me?

This is host is no longer used. Please have a look in latest examples. Also use formatting when pasting code.

Hello,

I have change it into blynk-cloud.com, but the same problems,
I have version 0.3.7

Hello,

I can not find the problem its seem to me thats in de connection but i have the latstet version
when i not use static Ip than the sketch run good and make only in the begin connection with the cloud and the connections stay and i can used the app
but when i make a static IP the sketch run good so far it reads the vaules but it stills after reading the values connetion with the cloud and it reads the values again and make a connection again it stays not connected so the app said that the arduino is offline
please help

Have someone ideas to fix the problem?

So the new blynk version has solved the problem

Thanks for all the help I do not get!