Problem with adding actuator


#1

Hi, I’m using Ethernet shield in my project to control the speed of DC motor. I tried to creat actuator, but shows pop up message like “can not connect with remote device”… please help soon as possible… :frowning: Screenshot_20180209_164820|281x500


#2

can you post the code.


#3

Thank you I solved it, and I had a small doubt. How to send a mapped value to dashboard from Arduino ??


#4

use “Cayenne.virtualWrite(1, x);” where x is your value.


#5

#include <PID_v1.h>
#define PIN_INPUT 0
#define PIN_OUTPUT 3
double Setpoint, Input, Output;
double aggKp = 4, aggKi = 0.2, aggKd = 1;
double consKp = 1, consKi = 0.05, consKd = 0.25;
PID myPID(&Input, &Output, &Setpoint, consKp, consKi, consKd, DIRECT);
void setup()
{
Input = analogRead(PIN_INPUT);
Setpoint = 100;
myPID.SetMode(AUTOMATIC);
Serial.begin(9600);
}

void loop()
{
Input = analogRead(PIN_INPUT);
double gap = abs(Setpoint - Input);
if (gap < 10)
{
myPID.SetTunings(consKp, consKi, consKd);
}
else
{
myPID.SetTunings(aggKp, aggKi, aggKd);
}
myPID.Compute();
analogWrite(PIN_OUTPUT, Output);
}


#6

This is my program. I want to change setpoint through internet and monitor the Input value in dashboard. So what are changes i want to do. I’m using Arduino Ethernet Shield.


#7

add a custom slider widget and read the status.

CAYENNE_IN(1)
{
  setpoint = getValue.asInt();
}
if (millis() - lastMillis > 10000) {
	lastMillis = millis();
	//Write data to Cayenne here. This example just sends the current uptime in milliseconds.
	Cayenne.virtualWrite(0, Input);
}

this will add a value widget to your dashboard automatically.


#8

Thank you so much :slight_smile: