RGB LED controlled with three sliders ** solved **

why does this program not work? no effect sliding the controls on the iPhone.
?? will the value from the slider directly given to the PWM ??
?? or do I have to process them in some way ??

  • it should be possible to get the values transferred from the iPhone into a variable to work with or to debug them

/*
RGB SLIDER
definitions on iPhone:

  • slider BLUE : D9
  • slider GREEN : D10
  • slider RED : D11

RGB LED connected to PWMpins D9, D10, D11

/
// I had to remove the "#
otherwise it would be formatted bold and in big letters
define BLYNK_PRINT Serial // Enables Serial Monitor
include SPI.h
include Ethernet.h
include BlynkSimpleEthernet.h // This part is for Ethernet stuff

int led1 = 9; // blue
int led2 = 10; // green
int led3 = 11; // red

char auth[] = “myToken”; // Put your Auth Token here. (see Step 3 above)

void setup()
{
Serial.begin(57600); // See the connection status in Serial Monitor
Blynk.begin(auth); // Here your Arduino connects to the Blynk Cloud.
}

void loop()
{
Blynk.run(); // All the Blynk Magic happens here…
}

  • What kind of connection do you use? Ethernet?
  • did you paste Auth Token from the app to your code?

It should work without any problems. No data processing is needed. By the way, if you add 4 spaces code can become code like this :wink:

char auth[] = "myToken"; // Put your Auth Token here. (see Step 3 above)

Here is a solution on an Arduino Ethernet board. I am still amazed at how little code it takes
and how fast the response is.

/* Environment: iMac running 10.10.3; Arduino IDE 1.6.4; iPhone 5S IOS 8.3
Arduino Ethernet Board Rev3 without POE
Power to board is coming through Arduino USB-toSerial adapter
Connected to iMac with Arduino USB-toSerial adapter
Connected to Netgear switch with ethernet cable
Switch cat 5e-cabled to ATT router using DHCP to serve IP to Arduino board

RGB LED (common anode pin connected to Arduino 5V; maximum slider value of 255 will turn LED off.
Other 3 LED pins connected through 330 ohm resistors;Red cathode to Arduino 5; Green to 6; Blue to 9

No feedback through Arduino Serial Monitor to minimize sketch, but that feedback is very useful
to see that connection is up. Sketch requires about 50% of the total flash in an ATmega328.

Problem: after uploading code to Arduino Ethernet board, and waiting about 5- 10 seconds
before activating iPhone connection, sometimes the blue LED turns on before changing any sliders.

App dashboard setup:
Slider widget (255…0) pin D5 RED
Slider widget (255…0) pin D6 GREEN
Slider widget (255…0) pin D9 BLUE */


     #include <SPI.h>
     #include <Ethernet.h>
     #include <BlynkSimpleEthernet.h>
            
     char auth[] = "my auth token";
            
     void setup()  {Blynk.begin(auth);}
     void loop()   {Blynk.run();}

@robrlstn : thanks for your example :slight_smile: , it get’s me to the mistake using SPI pins :frowning:
I have a common cathode RGB module with built in resistors. a simple “push-button” program runs properly on D5,D6,D7 (on/off only)
my slider D9,D10,D11 could not work

@Pavel : I’m using a duemillanove (328er) and an ethernet shield. the LED exemple runs good.
and sorry I did not understand your joke

SOLUTION: using the ethernet shield pin 10…13 should be blocked (in the widget or at compile time?)
Arduino communicates with both the W5100 and SD card using the SPI bus
(through the ICSP header). This is on digital pins 10, 11, 12, and 13
on the Uno

---- case solved & closed ----