Slider control passing values to arduino


#1

I am trying to create an Aquarium controller using Cayenne (I will post it on “Projects made…” once it is complete). I have a Raspberry Pi 2 with a wifi usb dongle and an arduino nano. The arduino is controlling all the fans, lights and pumps and the raspberry pi is checking the temperature and communication with Cayenne servers. The connection between raspberry pi and arduino nano is serial using a USB port.

I recently bought some neo pixels and I connected them to the arduino. To test them in Cayenne, I created three virtual pins (using three sliders) and I am trying to control the color of the neo pixels using each slider for the RGB values (one for red, one for green and one for blue).

The sliders do work but not in the detail I want and this is my question.

The sliders have minimum value 0 and maximum value 1, this setup allows to have value 0.0, 0.1, 0.2 … 1.0, increments of 10% from 0 to 1.
Since my arduino is connected with usb, it is pretty difficult to debug the values send from Cayenne to arduino.
I figured out that the slider will send 0 to 1024 meaning that in order to convert this to the range needed (0-255) I have to divide this by 4. So a value on the slider 0.4 will be sent as 409.6 and in arduino I will convert this to 102.4, in int that is 102. If I select 0.3 I will get 77, as you can understand the values between to places in the slider are too far apart to be able to accurately set the RGB color on the neo pixels.

I tried to change the minimum & maximum values of sliders to 0-255, which works in the Cayenne interface, but the values received in arduino seem to be from 01024 to 2551024 (at least that is what I figured out without having any debug info :frowning:).
Is it possible to setup the sliders to send values that can be translated to values from 0-255 in arduino? I want to be able to use all possible 256 values.

And another question, how close are you to release the RestFull API for Cayenne and the pi camera module integration? (eager to create a windows phone app for my project :slight_smile:)