so I'm trying to replace the bridge with eithernet to try and get the arduino to be able to interact with another network if its connected through the eithernet port I'm able to ping the arduino but when I try to type in the ip adress on the correct wireless network nothing happenes.
this is my full code it works if I replce everything eithernet with the bridge library I'll also post that code below
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <Console.h>
byte mac[] = {0x90, 0xA2, 0xDA, 0xF8, 0x23, 0x02};
IPAddress dnServer(155, 101, 100, 10);
IPAddress gateway(155, 101, 101, 1);
IPAddress ip(155, 101, 101, 51);
EthernetServer server(80);
unsigned long value;
int pin;
int onoff;
unsigned long value2;
int pin2;
int onoff2;
EthernetClient client;
void setup() {
Ethernet.begin(mac, ip, dnServer, gateway);
server.begin();
Console.begin();
}
void loop() {
if (client) {
process(client);
client.stop();
}
analogWrite(pin, value);
analogWrite(pin2, value2);
if (onoff == 1) {
digitalWrite (4, HIGH);
}
else {
digitalWrite (4, LOW);
}
if (onoff2 == 1) {
digitalWrite (2, HIGH);
}
else {
digitalWrite (2, LOW);
}
}
void process(EthernetClient client) {
String command = client.readStringUntil('/');
if (command == "analog") {
analogCommand(client);
}
}
void analogCommand(EthernetClient client) {
pin = client.parseInt();
if (client.read() == '/') {
onoff = client.parseInt();
if (client.read() == '/') {
value = client.parseInt();
if (client.read() == '/') {
pin2 = client.parseInt();
if (client.read() == '/') {
onoff2 = client.parseInt();
if (client.read() == '/') {
value2 = client.parseInt();
}
}
}
}
}
client.println("always use pin 5");
client.println("dont go above 123");
client.println("1 on 0 off");
}
this is the code with the bridge instead of the eithernet this works as long as im connected to the arduinos wifi.
#include <Bridge.h>
#include <BridgeServer.h>
#include <BridgeClient.h>
#include <Console.h>
BridgeServer server;
unsigned long value;
int pin;
int onoff;
unsigned long value2;
int pin2;
int onoff2;
void setup() {
Bridge.begin();
server.listenOnLocalhost();
server.begin();
Console.begin();
}
void loop() {
BridgeClient client = server.accept();
if (client) {
process(client);
client.stop();
}
analogWrite(pin, value);
analogWrite(pin2, value2);
if (onoff == 1) {
digitalWrite (4, HIGH);
}
else {
digitalWrite (4, LOW);
}
if (onoff2 == 1) {
digitalWrite (2, HIGH);
}
else {
digitalWrite (2, LOW);
}
}
void process(BridgeClient client) {
String command = client.readStringUntil('/');
if (command == "analog") {
analogCommand(client);
}
}
void analogCommand(BridgeClient client) {
pin = client.parseInt();
if (client.read() == '/') {
onoff = client.parseInt();
if (client.read() == '/') {
value = client.parseInt();
if (client.read() == '/') {
pin2 = client.parseInt();
if (client.read() == '/') {
onoff2 = client.parseInt();
if (client.read() == '/') {
value2 = client.parseInt();
}
}
}
}
}
client.println("always use pin 5");
client.println("dont go above 123");
client.println("1 on 0 off");
}