AllBot and Arduino Uno Wifi

Hello everyone,

I have built my Allbot with an Arduino.org board, Arduino Uno Wifi.

I’ve finally gotten the default code sample to work WebServerBlink, using the code below.

However when I combine the sample code with the AllBot Libraries and the ALLBOT variable, it stops working.
(to be precise: when I enable the following line it no longer works as expected.)
//ALLBOT BOT(8); // Number of motors
Can someone explain this?

Results before activating the line, while running I access the webpage (http://[IP]/arduino/webserver) and call both buttons.

Connecting to Wifibbox2-2690 & aabbccddee ..Success
~Connecting to Wifibbox2-2690 & aabbccddee ..Success
~Connecting to Wifibbox2-2690 & aabbccddee ..Success
~Connecting to Wifibbox2-2690 & aabbccddee ..Success
~[Motor Functions] Standing up
arduino
digital
[Motor Functions] Wide Stance
arduino
digital
[Motor Functions] Standing up
arduino
digital
[Motor Functions] Wide Stance

Results after

Nice to meet you, my name is Robby WebServer is up Connecting to Wifibbox2-2690 & aabbccddee ..Success
After which the webpage no longer loads http://[IP]/arduino/webserver

[code]#include <ArduinoWiFi.h>
#include “ALLBOT.h”
#include <Wire.h>
#include <Servo.h>
/*
on your borwser, you type http:///arduino/webserver/ or http://.local/arduino/webserver/
*/
//ALLBOT BOT(8); // Number of motors

int sounderPin = 13; // Declaring what pin the sounder on the VRSSM is connected to
enum MotorName {
hipFrontLeft,
hipFrontRight,
hipRearLeft,
hipRearRight,
kneeFrontLeft,
kneeFrontRight,
kneeRearLeft,
kneeRearRight
};
void setup() {
Serial.begin(2400);
Serial.println(“Nice to meet you, my name is Robby”);
pinMode(13, OUTPUT);

// NAME.attach(motorname, pin, init-angle, flipped, offset-angle);
/*BOT.attach(hipFrontLeft, A1, 45, 0, 0);
BOT.attach(hipFrontRight, A0, 45, 1, 0);
BOT.attach(hipRearLeft, 9, 45, 1, 0);
BOT.attach(hipRearRight, 4, 45, 0, 0);

BOT.attach(kneeFrontLeft, 11, 5, 1, 0);
BOT.attach(kneeFrontRight, 2, 5, 0, 0);
BOT.attach(kneeRearLeft, 10, 5, 1, 0);
BOT.attach(kneeRearRight, 3, 5, 0, 0);

// INIT sounder
pinMode(sounderPin, OUTPUT);

// Wait for joints to be initialized
delay(500);
Serial.println("[Motor Functions] Motors are initialized");
*/
Wifi.begin();
Wifi.powerON();
Wifi.println(“WebServer is up”);
Serial.println(“WebServer is up”);
connectAndCheck(“bbox2-2690”, “aabbccddee”);
}
void loop() {
//Serial.print(“Looping - Wifi availability”);
//Serial.println(“Loop”);
process(Wifi);
delay(50);
}

void connectAndCheck(char* ssid, char* pasw)
{
bool wifiConnected = false;
Wifi.connect(ssid, pasw);

Serial.print(“Connecting to Wifi” );
Serial.print(ssid);
Serial.print(" & “);
Serial.print(pasw);
Serial.print(” “);
delay(1500);
while (Wifi.available()) {
//Serial.print(Wifi.localIP());
Serial.println(”…Success");
wifiConnected = true;
process(Wifi);
}
if (wifiConnected == false)
{
Serial.println("…Failed");
}

}

void process(WifiData client) {
//Serial.println(“Processing Client”);
// read the command
String command = client.readStringUntil(’/’);
if (command.length() > 0) Serial.println(command);
// is “digital” command?
if (command == “webserver”) {
//Serial.println(“webserver”);
WebServer(client);
}

if (command == “digital”) {
//Serial.println(“digital”);
digitalCommand(client);
}
}

void WebServer(WifiData client) {
//Serial.println(“Starting Server”);
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);
client.println();
client.println("");

client.println(" “);
client.print(”");

client.print("


");
client.print("Knees Down <input type=button onClick="var w=window.open(’/arduino/digital/13/1’,’_parent’);w.close();“value=‘ON’>
”);
client.print("Wide Stance <input type=button onClick="var w=window.open(’/arduino/digital/13/0’,’_parent’);w.close();“value=‘OFF’>
”);

client.print("");
client.println("");
client.print(DELIMITER); // very important to end the communication !!!

}
void wideHipStance() {
Serial.println("[Motor Functions] Wide Stance");
/BOT.move(hipFrontLeft, 45);
BOT.move(hipFrontRight, 45);
BOT.move(hipRearLeft, 45);
BOT.move(hipRearRight, 45);
BOT.animate(500);
/
}
void kneesDown() {
Serial.println("[Motor Functions] Standing up");
/BOT.move(kneeRearLeft, 15);
BOT.move(kneeRearRight, 15);
BOT.move(kneeFrontLeft, 15);
BOT.move(kneeFrontRight, 15);
BOT.animate(200);
/
}
void digitalCommand(WifiData client) {
int pin, value;
// Read pin number
pin = client.parseInt();
// If the next character is a ‘/’ it means we have an URL
// with a value like: “/digital/13/1”
if (client.read() == ‘/’) {
value = client.parseInt();
if (value == 1)
{
kneesDown();
// Send feedback to client
client.println(“Status: 200 OK\n”);
client.print(F("kneesDown with params “));
client.print(pin);
client.print(F(” and "));
client.print(value);
client.print(EOL); //char terminator
}
else
{
wideHipStance();
// Send feedback to client
client.println(“Status: 200 OK\n”);
client.print(F("wideHipStance with params “));
client.print(pin);
client.print(F(” and "));
client.print(value);
client.print(EOL); //char terminator
}
}
}

[/code]

Further testing

Re-enabling the Serial.println(“Loop”); line in the loop method confirms the loop is still running.
So that’s not the problem.

[code]Nice to meet you, my name is Robby
WebServer is up
Connecting to Wifibbox2-2690 & aabbccddee …Success

Loop
Loop
Loop[/code]