Output seven colors with RGB lamp

Source: Internet
Author: User
Tags api manual

This article by Bo Master original, if there is not the place please specify, reprint please indicate the source.

Reference Blog: http://www.cnblogs.com/jikexianfeng/p/6243654.html

Reference website: http://wiki.geek-workshop.com/doku.php?id=arduino:arduino_language_reference

Reference Document: http://wiring.org.co/reference/

Reference page: http://www.cnblogs.com/jikexianfeng/p/6031291.html

1 /*********************************2 code function: Output analog signal, control the color of RGB lamp3 using functions:4 Pinmode (PIN number, mode);5 Analogwrite (PIN number, voltage parameter); Output analog voltage = 5/256* Voltage parameter6 constrain (input parameter, interval lower bound, upper bounds of interval); Interval function7 random (randomly seeded); Generate a random number8 for specific function usage, please refer to another blogger document: "Arduino API Manual"9 Website:http://www.cnblogs.com/jikexianfeng/p/6243654.htmlTen creation time: 2017*1*4 One Author Email: [Email protected] A ********************************/ - intRedpin = One;//Red - intGreenpin =Ten;//Green the intBluepin =9;//Blue -  - voidSetup () { - Pinmode (redpin,output); + Pinmode (greenpin,output); - Pinmode (bluepin,output); + } A voidLoop () at { -Randomseed (Analogread (0)); -      for(intx=0; x< the; x + +){ -          -Analogwrite (Redpin,constrain (Random ( the),0,255)); -Analogwrite (Greenpin,constrain (Random ( the),0,255)); inAnalogwrite (Bluepin,constrain (Random ( the),0,255)); -Delay -); to     } +}

Output seven colors with RGB lamp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.