For this example, attach a LED to a PWM-enabled Pin on your Arduino Uno. Let’s use D6 in this example.
Arduino Luminosity Step 2

Click Add New > Device / Widget.
Add New Device

  1. Choose Actuator > Light > Luminosity.
  2. Choose Virtual from the I/O field.
  3. We will use Virtual Pin 1 for this example. Choose V1 from the Pin field.
  4. Click the Step 1: Sketch File button to view the sketch file.

Arduino Luminosity Add Device

A popup will appear showing the Luminosity sketch file. Copy the sketch file contents to the clipboard and open Arduino IDE.
Arduino Luminosity Sketch File

Paste the Luminosity sketch file code into the Arduino IDE. After copying & pasting the example sketch files:https://github.com/myDevicesIoT/CayenneArduinoSamples/tree/master/Actuators, you will want to double check that your authentication token is correct as well as update any pin assignments that appear in the sketch file.

In this case, the example sketch file assumes that we used Digital Pin 3 to connect our Luminosity actuator, but we used Digital Pin 6 instead. We will need to update the sketch file to correct the pin. Find and update the LED_DIGITAL_PIN definition so that it points at pin 6.

#define LED_DIGITAL_PIN 6

After verifying the sketch file looks good, select Sketch > Upload to upload the sketch file to your device.
Arduino Luminosity in Arduino IDE

In the Cayenne dashboard, you can now click the Step 2: Add Actuator button and the luminosity widget will be added to your dashboard. You can now use the slider to control the brightness of the LED.
Arduino Luminosity

Leave a Reply

WordPress spam blocked by CleanTalk.
Bombax Theme designed by itx