Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot-open:practical:hardware:rtu:robotnest:rgb-led [2025/07/30 09:02] kivilands6en:iot-open:practical:hardware:rtu:robotnest:rgb-led [2025/07/30 09:05] (current) kivilands6
Line 3: Line 3:
  
 ====== Step 1 ===== ====== Step 1 =====
-define the necessary pins and functions:+Define the necessary pins and functions:
 <code> <code>
 /* RGB LEDS */ /* RGB LEDS */
Line 12: Line 12:
 </code> </code>
 ====== Step 2 ===== ====== Step 2 =====
-define pins as output:+Define pins as output:
 <code> <code>
 void setup() { void setup() {
Line 23: Line 23:
 </code> </code>
 ====== Step 3 ===== ====== Step 3 =====
 +Add a function at the end of the code: 
 +<code> 
 +void setRGB(int red, int green, int blue) { 
 +  analogWrite(RED_PIN, green); 
 +  analogWrite(GREEN_PIN, blue); 
 +  analogWrite(BLUE_PIN, red); 
 +
 +</code>
 ====== Step 4 ===== ====== Step 4 =====
 +Write some code for the LED's (circle through red, green, blue light): 
 +<code> 
 +void loop() { 
 +  setRGB(255, 0, 0); 
 +  delay(1000); 
 +  setRGB(0, 255, 0); 
 +  delay(1000); 
 +  setRGB(0, 0, 255); 
 +  delay(1000); 
 +
 +</code>
en/iot-open/practical/hardware/rtu/robotnest/rgb-led.1753866165.txt.gz · Last modified: 2025/07/30 09:02 by kivilands6
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0