ok, so we have made some progress!
The issues are all related to the Arduino IDE and the esp core that it's using, I can't tell exactly if it's also to do with the version of the ide itself maybe 1.8 is fine.
I have updated the websockets last night everywhere but to be safe I would just re download them and replace them just one more time.
The code builder works differently than the tutorials and I will explain how to use it but not right now, you will not get any led control code from it without using plugins so what you are getting is just an clean canvas only with the communication code setup and you need to fill in the rest.
Don't worry, you just need first to cover the very basics.
The compile error you have listed is again related to the ChipChop library vs 1.41 which you are not using so it sounds to me that you are following the tutorial and trying to compile the examples which won't work.
I am really sorry for this but I am working on a major update for the last 6 months and I can't re-film the tutorials so the info is not in sync. I don't want you to stop using the code builder because it's how things will work in the future so please follow the tutorials but keep in mind that you will have to tweak the code slightly.
So, from now on do this, setup your device in the Dev Console and download the project template from the Code Builder and put it in the Arduino IDE folder and open it.
Then open separately one of the examples in a different window, copy the code and then replace in the new code everything except the following
don't use this from the example:
#include <ChipChopManager.h>
ChipChopManager ChipChop;
it needs to stay in the code builder project
#include "src/ChipChop_Config.h"
#include "src/ChipChopEngine.h"
extern ChipChopEngine ChipChop;
#include "src/ChipChopPlugins.h"
extern ChipChopPluginsManager ChipChopPlugins;
#include "src/ChipChop_Includes.h"
in the setup it also needs this somewhere at the end
void setup(){
.....all the code from the example and then
ChipChopPlugins.start();
}
in the example code this
void loop(){
ChipChop.run();
}
needs to be
void loop(){
ChipChop.run();
ChipChopPlugins.run();
}
So, for your MyLedTwo, download the blank project from the code builder and open it and replace the code with this (of course add your credentials, wifi details and you may have to change the led pin number)
#include <Arduino.h>
#ifdef ESP32
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif
#include "src/ChipChop_Config.h"
#include "src/ChipChopEngine.h"
extern ChipChopEngine ChipChop;
#include "src/ChipChopPlugins.h"
extern ChipChopPluginsManager ChipChopPlugins;
#include "src/ChipChop_Includes.h"
//The connection credentials can be found in the device settings Dev Console > Devices
String server_uri = "...your allocated Endpoint Server URI...";
String uuid = "...your ChipChop UUID ...";
String auth_code = "... your Security Authentication Code ...";
String device_id = "my_led_two";
String led_status = "OFF"; // the device will start with the led turned off
const int led_pin = 2; // define the pin that will control the led
void ChipChop_onCommandReceived(String target_component,String command_value, String command_source, int command_age){
Serial.println(target_component);
Serial.println(command_value);
if(target_component == "myLedTwo"){
if(command_value == "ON"){
led_status = "ON"; //update the status
digitalWrite(led_pin,LOW); // turn the led on
}else if(command_value == "OFF"){
led_status = "OFF";//update the status
digitalWrite(led_pin,HIGH); // turn the led off
}
}
ChipChop.updateStatus("myLedTwo",led_status); // Confirm the LED status change
}
void setup(){
Serial.begin(115200);
delay(1000);
WiFi.begin("< your SSID >", "< your wifi password >");
Serial.print("WiFi Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
pinMode(led_pin,OUTPUT); // declare the led pin as an output
digitalWrite(led_pin,HIGH); // turn the led off, may have to change this to LOW
ChipChop.debug(true);
ChipChop.commandCallback(ChipChop_onCommandReceived);
ChipChop.start(server_uri, uuid, device_id, auth_code);
ChipChopPlugins.start();
ChipChop.updateStatus("led",led_status);
}
void loop(){
ChipChop.run();
ChipChopPlugins.run();
}
If this compiles and gets on the device ok, then open in Arduino IDE the serial monitor and you should see the communication getting established. In the Dev Console go to LIVE CONTROL and from there you can switch the led on and off