Hai there. I am a new beginner at Cayenne. My first project fails and i hope to solve it soon. I have use a slide for controlling a led but when i measure or use the D3 or any other PWN pin starts the trouble.
when the slider is on 0 led off but when on 1 it is full on. slider reacts as a switch ( on or off ).
i want to use it to control a rgb led. Please can you help me.
using web and mobile app
used uno and mega with 2 different 5100 lan shield
measured output current ( gives 4.68 volt and stays that way untill off or 0 )
Could you share with us the sketch that you’re using to interact with Cayenne? And a screenshot of the settings page for the Slider widget you’ve created in Cayenne?
standard skets nothing changed, my token is now xxxxxxx☺
- Set the token variable to match the Arduino token from the Dashboard.
- Compile and upload this sketch.
For Cayenne Dashboard widgets using digital or analog pins this sketch will automatically
send data on those pins to the Cayenne server. If the widgets use Virtual Pins, data
should be sent to those pins using virtualWrites. Examples for sending and receiving
Virtual Pin data are under the Basics folder.
//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token = “xxxxxxxxxx”;
This is what I needed to do to make the slider work:
float currentValue = getValue.asDouble(); // NOT getValue.asInt()
currentValue = currentValue / 1023; //Divide the received value by 1023
Now, the float variable currentValue holds the input value, and can be used at output for instance to a PWM pin:
analogWrite(LED_DIGITAL_PIN, currentValue); // must be from 0 to 255
Just enable custom range on slider widget and give 0 to min and 4 to max with using example slider sketch.
This can result a linear pwm
I am new to Cayenne Community.
I am also having a somewhat similar issue but with a little change.
I am using an LED on pin-11 of Arduino MEGA with W5100 ethernet shield on PWM application. The custom range of slider that i set on my PC dashboard is 0 to 255 and it works fine with PC but when it comes to android app. it shows range 0 to 1 instead of 0 to 255. That is, its either 0 or 1.
Any help on the issue would be really appreciable.