TUTORIALS 》 Slow RGB Fade via Arduino UNO
/* The Linux Channel * Code for Video Episode: 0x191 Slow RGB Fade via Arduino UNO * Author: Kiran Kankipati * Updated: 25-Dec-2018 * * adopted from Examples => Basics => Fade * http://www.arduino.cc/en/Tutorial/Fade * * DISCLAIMER: * 1. This is just a simple sample code with little bit of my own touch. * By no means I write a real production code this way. It will be much more streamlined * and organized within APIs and data-structures as much as possible. * * 2. If you are beginner or a student, put more emphasis in writing simple straightforward * easy to understand functional code. Always focus on end application/result than writing any * complex cryptic code in an attempt to express your coding skills. */ int redled = 11; int greenled = 10; int blueled = 6; int i=0; int k=0; int incrementdelay=5; void setup() { pinMode(redled, OUTPUT); pinMode(greenled, OUTPUT); pinMode(blueled, OUTPUT); } void ledUpDown(int led) { for(k=0;k<255;k+=5) { analogWrite(led, k); delay(incrementdelay); } for(k=255;k>=0;k-=5) { analogWrite(led, k); delay(incrementdelay); } analogWrite(led, 0); } void loop() { ledUpDown(redled); ledUpDown(greenled); ledUpDown(blueled); delay(2000); }
Featured Video:
Suggested Topics:
Join The Linux Channel :: Facebook Group ↗
Visit The Linux Channel :: on Youtube ↗
💗 Help shape the future: Sponsor/Donate
Temas recomendados:
Featured Video:
Trending Video:
Software Programming Standards (Coding Standards) ↗
Saturday' 13-Mar-2021
Recommended Video: