Hi, I can't see the analog reading value (A0) on the platform.
Can anyone tell me where I'm going wrong?
Thank you.
#include <Arduino.h>
#ifdef ESP32
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif
#define CHIPCHOP_DEBUG true //set to false for production
#include "src/ChipChop_Config.h"
#include "src/ChipChopEngine.h"
extern ChipChopEngine ChipChop;
//Plugins included: ChipChop Engine,Keep Alive,WiFi Portal,Preferences Manager,OTA (Over the air updates),
#include "src/ChipChopPlugins.h"
extern ChipChopPluginsManager ChipChopPlugins;
#include "src/ChipChop_Includes.h"
#include <SimpleTimer.h>
SimpleTimer timer;
//******************** connection credentials can be found in the device settings ********************
String server_uri = "wss://api1.chipchop.io/wsdev/";
String uuid = "ChpChp**x0366b******029a72b";
String auth_code = "e37558bf7d4c4*******cdd";
String device_id = "testacq";
//******************** connection credentials can be found in the device settings ********************
int livello ;
void ChipChop_onCommandReceived(String target_component,String command_value, String command_source, int command_age){
Serial.println(target_component);
Serial.println(command_value);
// If you are using the AutoMode plugin, just handle here components that are not managed by AutoMode
}
void setup(){
Serial.begin(9600);
delay(1000);
timer.setInterval(1000L, myTimerEvent);
//WifiPortal.ssid("", "");// Optional: set default WiFi Portal ssid & password <br>or remove this line and use your phone to set the WiFi portal
//basic ChipChop engine settings, all others are in the ChipChop_config.h ////
ChipChop.debug(true); //set to false for production
ChipChop.commandCallback(ChipChop_onCommandReceived);
ChipChop.start(server_uri, uuid, device_id, auth_code);
ChipChopPlugins.start();//Start all plugins
ChipChop.updateStatus("livello",livello);// set here the initial status for all components that are not handled by the AutoMode plugin
}
void myTimerEvent(){
livello = analogRead (A0);// acquisisce il segnale del sensore
ChipChop.updateStatus("livello",livello);
}
void loop(){
//keep the ChipChop engine and plugins running
ChipChop.run();
ChipChopPlugins.run();
}