Trying my first project on Cayenne- not working!

I’m afraid I am falling at the first hurdle!
Connected Ethernet shield and get the dashboard.
Adding the Luminosity widget setting the virtual channel to V1.
I get the following error:

  • Please fix the following errors:
    Please turn on the device

The board is connected to the Ethernet and the USB is connected to the UNO.

When compiling there are 2 errors:

  • Invalid library found in D:\My Files\Arduino\libraries\ble-sdk-arduino-0.9.0.beta: no headers files (.h) found in D:\My Files\Arduino\libraries\ble-sdk-arduino-0.9.0.beta

  • Invalid library found in D:\My Files\Arduino\libraries\nRF8001-20140509: no headers files (.h) found in D:\My Files\Arduino\libraries\nRF8001-20140509

I did not think that these were applicable to the project as they may have been to do with a Bluetooth project I was working on.
Can someone help my get started?

I have just tried setting up again, using a different UNO board name and I don’t get the ‘Turn on the device’ error, but when I use the slider the LED does not light up when I move the slider!
I am connected to pin 3 which is the pin set in the sketch.
What’s wrong now!

Just noticed something else! There is a banner across the top saying ‘Offline’!
No doubt this is the problem, but how do I turn it back online?

can you share the code. Add #define CAYENNE_DEBUG in your code and check the serial monitor if there is any issue.

Hi
The code and post upload output are attached. I added the debug line as requested. Does the errors appear in output below sketch? Ethernet Sketch.txt (2.1 KB) Luminosity Errors.txt (8.9 KB) Luminosity sketch.txt (2.0 KB)

can you share a bit more output from the serial monitor

Sorry You did ask!
Here it is:
[0] MAC: FE-39-2C-A3-57-59
[4737] IP: 192.168.1.174
[4738] Connecting to mqtt.mydevices.com:1883
[5000] Connected
[5103] Publish: topic 4, channel 65534, value Arduino Uno, subkey , key
[5114] Publish: topic 6, channel 65534, value ATmega328P, subkey , key
[5190] Publish: topic 7, channel 65534, value 16000000, subkey , key
[5264] Publish: topic 5, channel 65534, value 1.3.0, subkey , key
[5335] Publish: topic 8, channel 65534, value W5100, subkey , key
[16487] Connection ok

and what do you get in the serial monitor when you turn on the button.

Going backward! Now getting ‘Switch on device’ error again!
Question: Do you have to upload the Ethernet sketch each time you restart using Cayenne?
When it says switch on device, what action do I need to take to rectify the problem>
I don’t understand what it is saying as the UNO is powered up and the Ethernet card is talking to the sever?
Where do I go from here?

it means that your arduino device is not connected to internet. Check you serial monitor. Can you share the code you are using.

Right something is working now! Now got switch on dashboard.
When I switch on and off no activity on serial monitor, only the initial connected message.
The leds on the Ethernet shield Rx and Tx are flashing. There is a lot of activity on the Rx and occasional Tx activity. When I click on the switch the Tx light flashes once.
How can I check the logon credentials whilst viewing the dashboard, just want to double check they are right?
Here is the sketch:
Switch.txt (1.9 KB)

try this code:

/*
Cayenne Light Switch Example

This sketch shows how to set up a Light Switch with Cayenne.

The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:
1. In the Cayenne Dashboard add a new Light Switch Widget.
2. Select a virtual channel number for the widget.
3. Set the VIRTUAL_CHANNEL value below to virtual channel you selected.
4. Attach the negative leg of an LED to ground and the other leg to the selected digital pin.
   Schematic:
   [Ground] -- [LED] -- [Resistor] -- [Digital Pin]
5. Set the ACTUATOR_PIN value below to the pin number you used when connecting your LED.
6. Set the Cayenne authentication info to match the authentication info from the Dashboard.
7. Compile and upload this sketch.
8. Once the Arduino connects to the Dashboard you can use the widget button to turn the LED on and off.
*/

#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneMQTTEthernet.h>

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "7xxxxx";
char password[] = "xxxx";
char clientID[] = "9xxxx";

#define VIRTUAL_CHANNEL 1
#define ACTUATOR_PIN 4 // Do not use digital pins 0 or 1 since those conflict with the use of Serial.

void setup()
{
  Serial.begin(9600);
  pinMode(ACTUATOR_PIN, OUTPUT);
  Cayenne.begin(username, password, clientID);
}

void loop()
{
  Cayenne.loop();
}

// This function is called when data is sent from Cayenne.
CAYENNE_IN(VIRTUAL_CHANNEL)
{
  int value = getValue.asInt();
  CAYENNE_LOG("Channel %d, pin %d, value %d", VIRTUAL_CHANNEL, ACTUATOR_PIN, value);
  // Write the value received to the digital pin.
  digitalWrite(ACTUATOR_PIN, value);
}

CAYENNE_OUT_DEFAULT()
{
	// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
	Cayenne.virtualWrite(0, millis());
}

you will see a green widget with channel 0. Add it by clicking on + on the widget. Next, delete the current button widget and add a new one for channel 1.

I take it I have to enter my credentials?

yes.

I got a little confused as it still said Channel 0 and at first would not work so went into settings and changed the channel to 1, then it worked, but I have 2 channels on the dashboard and even if I go into settings and remove channel 0, it still comes back after a few seconds. How do I remove it?
Can you explain why the modified code works?

i did not understand what you have done, but i would suggest delete all the widget and let start new.
the code i gave you, is notting but an extra function which sends the millis to cayenne on channel 0. which is why it keeps on poping up and you need to make it permanent by clicking on + of the widget.
i added this because, you need to keep on sending data to let the dashboard know that the device is online.
Next, add a new button widget with channel 1.

If you don’t understand whats going on, I certainly don’t!
I did add another button and that works too.
I tried adding the Luminosity slider (remembering of course to change the PWM pin to 3) and the sketch. Did not work! Also added the millisec code. Still did not work!
reloaded the switch code and that still works.
Something somewhere must be different and is stopping the data transfer?

Did you mention anything about slider in your previous post? i answered to what you had asked.
For slider can you share the entire code you are using.

Sorry I thought I would try a different widget as the switch seemed to work OK.
Luminosity sketch.txt (2.0 KB)
Just swapped back to the switch and is still working.
It must be the sketch causing the problems I think!

CAYENNE_OUT_DEFAULT()
{
	// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
	Cayenne.virtualWrite(0, millis());
}

i hope you understand what i am saying.