In a previous post we looked at the Goouuu-S1 ESP8266 , on the board you will have seen that there is an RGB led
The board uses the following pins for the LED
int redpin = 12; // select the pin for the red LED
int bluepin = 14; // select the pin for the blue LED
int greenpin =13; // select the pin for the green LED
Code Examples
[codesyntax lang=”cpp”]
int redpin = 12; // select the pin for the red LED int bluepin = 14; // select the pin for the blue LED int greenpin =13; // select the pin for the green LED int val=0; void setup () { pinMode (redpin, OUTPUT); pinMode (bluepin, OUTPUT); pinMode (greenpin, OUTPUT); Serial.begin (9600); } void loop () { for (val=255; val>0; val--) { analogWrite (redpin, val); analogWrite (bluepin, 255-val); analogWrite (greenpin, 128-val); delay (50); } for (val = 0; val <255; val++) { analogWrite (redpin, val); analogWrite (bluepin, 255-val); analogWrite (greenpin, 128-val); delay (50); } Serial.println (val, DEC); }
[/codesyntax]
And another example
[codesyntax lang=”cpp”]
int redpin = 12; // select the pin for the red LED int bluepin = 14; // select the pin for the blue LED int greenpin =13; // select the pin for the green LED int val=0; void setup () { pinMode (redpin, OUTPUT); pinMode (bluepin, OUTPUT); pinMode (greenpin, OUTPUT); Serial.begin (9600); } void loop () { LEDOff(); REDOn(); LEDOff(); GREENOn(); LEDOff(); BLUEOn(); } void LEDOff() { digitalWrite(redpin,HIGH); digitalWrite(greenpin, HIGH); digitalWrite(bluepin, HIGH); delay (500); } void REDOn() { digitalWrite(redpin,LOW); digitalWrite(greenpin, HIGH); digitalWrite(bluepin, HIGH); delay (500); } void GREENOn() { digitalWrite(redpin,HIGH); digitalWrite(greenpin, LOW); digitalWrite(bluepin, HIGH); delay (500); } void BLUEOn() { digitalWrite(redpin,HIGH); digitalWrite(greenpin, HIGH); digitalWrite(bluepin, LOW); delay (500); }
[/codesyntax]
Thanks! This post has been very helpful.
But it turns out – the onboard LED is one of the very poor quality. So I will still use the separate WS2812 RGB LED.
I have a Goouuu-S1 ESP8266 and can not find much information on the module.
Would like to know what to use to program the module and how.
The module has two switches which are not marked, what are they for?
Thanks