Looking to drive a standard little servo motor (0 to 180 degrees) using a slider control. Can anyone share a tutorial on how to do this or point me to any reference projects? Google and searching the community projects not helping too much.
Looks very easy so I tried in a program but got an error when test compiling.
/Users/tett/Documents/Arduino/Cayenne_Wemos_test/Cayenne_Wemos_test.ino: In function βvoid loop()β:
Cayenne_Wemos_test:29: error: a function-definition is not allowed here before β{β token
{
^
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = ββ;
char password = ββ;
char clientID = ββ;
long lastMillis = 0;int x = 0;
CAYENNE_IN(1)
{
int y= getValue.asInt();
myservo.write(y);
}
//Publish data every 1 seconds (1000 milliseconds). Change this value to publish at a different interval.
if (millis() - lastMillis > 100) {
lastMillis = millis();
x = digitalRead(4);
Cayenne.virtualWrite(1, x, βdigital_sensorβ, βdβ);