Home

Grove - Chainable RGB LED User Manual

image

Contents

1. self setColorRGB i 0 0 0 def clk self GPIO output self clk pin GPIO LOW time sleep 0 00002 GPIO output self clk pin GPIO HIGH time sleep 0 00002 def sendByte self b Send one bit at a time starting with the MSB for i in range 8 If MSB is 1 write one and clock it else write 0 and clock if b amp 0x80 0 GPIO output self data pin GPIO HIGH else GPIO output self data pin GPIO LOW self clk 0 Advance to the next bit to send b b lt 1 def sendColor self red green blue Start by sending a byte with the format 1 1 B7 B6 G7 G6 R7 R6 Hprefix B11000000 prefix 0xC0 17 y seeed Grow the Difference if blue amp 0x80 0 Hprefix B00100000 prefix 0x20 if blue amp 0x40 0 prefix B00010000 prefix 0x10 if green amp 0x80 0 prefix B00001000 prefix 0x08 if green amp 0x40 0 prefix B00000100 prefix 0x04 if red amp 0x80 0 Hprefix B00000010 prefix 0x02 if red amp 0x40 0 Hprefix B00000001 prefix 0x01 self sendByte prefix Now must send the 3 colors self sendByte blue self sendByte green self sendByte red def setColorRGB self led red green blue Send data frame prefix 32x 0 self sendByte 0x00 self sendByte 0x00 self sendByte 0x00 self sendByte 0x00 amp Send color data for each one of the leds for i in rang
2. Open the example CycleThroughColors by the path File gt Examples gt CnainableLED master and upload it to Seeeduino Example of using the ChainableRGB library for controlling a Grove RGB This code cycles through all the colors in an uniform way This is accomplished using a HSB color space e include lt ChainableLED h gt define NUM LEDS 5 ChainableLED leds 7 8 NUM LEDS void setup float hue 0 0 boolean up true void loopO Grow the Difference y seeed for byte i 0 i lt NUM LEDS i leds setColorHSB i hue 1 0 0 5 delay 50 if up hue 0 025 else hue 0 025 if hue gt 1 0 amp amp up up false else if hue lt 0 0 amp amp up up true You can observe this scene colors of two LED will gradient consistently Extend application Based on Chainable LED Library we have designed this demo RGB color varies with the temperature measured by Grove temperature The RGB color vary from green to red when the temperature is from 25 to 32 The test code is shown below Do it if you are interested in it demo of temperature gt rgbLED temperature form 25 32 rgbLed from green gt red Grove temperature plu to A0 LED plug to D7 D8 include lt Streaming h gt include lt ChainableLED h gt define TEMPUP 32 define TEMPDOWN 25 ChainableLED leds 7 8 1 connect to pin7 and pin8 one led int get
3. Grow the Difference V y seeed Grove Chainable RGB LED User Manual Release date 2015 9 22 Version 1 0 Wiki http www seeedstudio com wiki index php title Twig Chainable RGB LED Bazaar http www seeedstudio com depot Grove Chainable RGB LED p 850 html cPath 81 35 y seeed Grow the Difference Document Revision History y seeed Grow the Difference Contents Document Revision History eRe rere rie tee ce RR AGAR NUR CURA UU EROR Mtoe eee ee mire ee eet acme ieee OL 2 l Introduction Taare ee Te Tee Te ee Te ee a E eee ee ee er ee E E ee A 2 2 Specification RS REEL LT LIMITI EIE TIE 3 3 Usage PR al ev aS 16 corsave 8 808i aia eve eleva TELTTA aie erate 4 41 AR EE LL D era ee EEEE REE EE E 4 3 2 With Raspberry Pi 7 3 3 With Beaglebone Green EEEO PE T EIT E E E TEA TE A PA Rub iR EA EUR ace EUER IPIE Ere T Ba ene E EM 16 d JosnUtbppeesdipreturtetasat qsCtsxp PEERS da AR ashe ran Sa dm 20 y seeed Grow the Difference Disclaimer For physical injuries and possessions loss caused by those reasons which are not related to product quality such as operating without following manual guide natural disasters or force majeure we take no responsibility for that Under the supervision of Seeed Technology Inc this manual has been compiled and published which covered the latest product description and specification The content of this manual is subject to change without notice Copyright
4. The design of this product including software and its accessories is under tutelage of laws Any action to violate relevant right of our product will be penalized through law Please consciously observe relevant local laws in the use of this product seeed Grow the Difference 1 Introduction Chainable RGB LED is based on P9813 chip which is a full color light source LED driver chip and can provide constant current drive and modulated output of 256 gray Transmission by wire DATA and CLK built in recycling can enhance the transmission distance y seeed Grow the Difference 2 Specification Operating Voltage 5V Operating Current 20mA Communication Protocol Serial y seeed Grow the Difference 3 Usage 3 1 With Arduino When you get Grove Chainable RGB LED you may think how I can light up it Now we will show you this demo all colors of RGB cycles in a uniform way The hardware installation like this Picture To complete this demo you can use one or more Grove Chainable RGB LED Note that the IN interface of one Grove Chainable RGB LED should be connect to D7 D8 of Grove Base Shield and its OUT interface connect to IN interface of another Grove Chainable RGB LED chainable more LED in this way Jasa seo Jasa seo jakarta Download Chainable LED Library and install it to Arduino Library There is the course about how to install Arduino Library in wiki page
5. sleep 1 print Test 2g Test Patterns yellow 8 test pattern 6 yellow grovepi chainableRgbLed test pin numleds testColorYellow time sleep 1 print Test 2h Test Patterns white 8 test pattern 7 white grovepi chainableRgbLed test pin numleds testColorWhite time sleep 1 pause so you can see what happened time sleep 2 reset all off grovepi chainableRgbLed test pin numleds testColorBlack time sleep 5 print Test 3a Set using pattern this led only change color to red grovepi storeColor 255 0 0 time sleep 5 set led 3 to red grovepi chainableRgbLed pattern pin thisLedOnly 2 time sleep 5 pause so you can see what happened time sleep 2 reset all off grovepi chainableRgbLed test pin numleds testColorBlack time sleep 5 print Test 3b Set using pattern all leds except this 10 y seeed Grow the Difference 8 change color to blue grovepi storeColor 0 0 255 time sleep 5 8 set all leds except for 3 to blue grovepi chainableRgbLed pattern pin allLedsExceptThis 3 time sleep 5 pause so you can see what happened time sleep 2 reset all off grovepi chainableRgbLed test pin numleds testColorBlack time sleep 5 print Test 3c Set using pattern this led and inwards 8 change color to green grovepi storeColor 0 255 0 time sleep 5 8 set leds 1 3 to green gr
6. pin numleds time sleep 5 change color to green grovepi storeColor 0 255 0 time sleep 5 set led 1 to green grovepi chainableRgbLed pattern pin thisLedOnly 0 time sleep 5 change color to red grovepi storeColor 255 0 0 time sleep 5 set led 10 to red grovepi chainableRgbLed pattern pin thisLedOnly 9 time sleep 5 pause so you can see what happened time sleep 2 y seeed Grow the Difference reset all off grovepi chainableRgbLed test pin numleds testColorBlack time sleep 5 print Test 2a Test Patterns black test pattern 0 black all off grovepi chainableRgbLed test pin numleds testColorBlack time sleep 1 print Test 2b Test Patterns blue 8 test pattern 1 blue grovepi chainableRgbLed test pin numleds testColorBlue time sleep 1 print Test 2c Test Patterns green test pattern 2 green grovepi chainableRgbLed test pin numleds testColorGreen time sleep 1 print Test 2d Test Patterns cyan 8 test pattern 3 cyan grovepi chainableRgbLed test pin numleds testColorCyan time sleep 1 print Test 2e Test Patterns red 8 test pattern 4 red grovepi chainableRgbLed test pin numleds testColorRed time sleep 1 print Test 2f Test Patterns magenta 8 test pattern 5 magenta grovepi chainableRgbLed test pin numleds testColorMagenta y seeed Grow the Difference time
7. 2 y seeed Grow the Difference grovapi chainablerRgsLeel moculo pin O 2 time sleep 5 pause so you can see what happened time sleep 2 print Test 4o Set using modulo every 2 offset 1 change color to green GLOWSOL StoreColoz 0 255 0 time sleep 5 set every 2nd led to green offset 1 Groveprchainadlence lec module pin T 2 time sleep 5 pause So you can see what happened time sleep 2 reset all off grovapi chainablergoLec test pin numleds testColorslacik time sleep 5 print Tesi 4g Set using modulo every 3 cfiset 0 change color to red grovepi storeColor 255 0 0 time sleep 5 set every 3nd led to red groyepi ehainealbleRgoLlee moculo pin S time sleep 5 change color to green grovepi storeColor 0 255 0 time sleep 5 set every 3nd led to green offset 1 CLO Vcr chainaibleRgoLeel moculo pin S time sleep 5 change color to blue y seeed Grow the Difference grovepi storeColor 0 0 255 time sleep 5 set every 3nd led to blue offset 2 groyepi chadnesileRgblea modu lic Pin 2 3 time sleep 5 pause so you can see what happened time sleep 2 reset all off Creer engem epos pin md cese ote el time sleep 5 print Test 4e Set using modulo every 3 offset 1 change color to yellow grovepi storeColor 255 255 0 time sleep 5 set every 4nd led to yellow Groveol chainablergoLleel moculo p
8. Analog get value from AO int sum 0 for int i 0 i lt 32 i sum analogRead AO y seeed Grow the Difference return sum gt gt 5 float getTemp get temperature float temperature 0 0 float resistance 0 0 3975 B value of the thermistor int B int a getAnalog resistance float 1023 a 10000 a get the resistance of the sensor temperature 1 log resistance 10000 B 1 298 15 273 15 convert to temperature via datasheet return temperature void ledLight int dta light led dta dta 4 0 255 dta 255 dta int colorR int colorG int colorB 0 leds setColorRGB 0 colorR colorG colorB void setup Serial begin 38400 cout lt lt hello world lt lt endl void loop float temp getTemp int nTemp temp 100 nTemp nTemp gt TEMPUP 100 TEMPUP 100 nTemp lt TEMPDOWN 100 TEMPDOWN 100 nTemp nTemp map nTemp TEMPDOWN 100 TEMPUP 100 0 1023 ledLight nTemp y seeed Grow the Difference delay 100 3 2 With Raspberry Pi 1 You should have got a raspberry pi and a grovepi or grovepi 2 You should have completed configuring the development enviroment otherwise follow here 3 Connection Plug the sensor to grovepi socket D7 by using a grove cable 4 Navigate to the demos directory cd yourpath GrovePi Software Python To see the code nano grov
9. ainable RGB LED eagle file e P9813 datasheet e Chainable RGB LED Library for the P9813 Github repository for Chainable RGB LED Library new 20
10. e chainable rgb led py Ctrl x to exit import time import grovepi Connect first LED in Chainable RGB LED chain to digital port D7 In CI DI VCC GND Out CO DO VCC GND pin 7 I have 10 LEDs connected in series with the first connected to the GrovePi and the last not connected 8 First LED input socket connected to GrovePi output socket connected to second LED input and so on numleds 1 grovepi pinMode pin OUTPUT time sleep 1 Chainable RGB LED methods grovepi storeColor red green blue grovepi chainableRgbLed init pin numLeds grovepi chainableRgbLed test pin numLeds testColor grovepi chainableRgbLed pattern pin pattern whichLed grovepi chainableRgbLed modulo pin offset divisor TE HR E HH EN EE grovepi chainableRgbLed setLevel pin level reverse y seeed Grow the Difference test colors used in grovepi chainableRgbLed test testColorBlack 0 0b000 8000000 testColorBlue 1 0b001 0000FF testColorGreen 2 0b010 00FF00 testColorCyan 3 0b011 OOFFFF testColorRed 4 0b100 FF0000 testColorMagenta 5 Ob101 FFOOFF testColorYellow 6 Ob110 FFFFOO testColorWhite 7 Obl11 FFFFFF patterns used in grovepi chainableRgbLed pattern thisLedOnly 0 allLedsExceptThis 1 thisLedAndInwards 2 thisLedAndOutwards 3 try print Test 1 Initialise init chain of leds grovepi chainableRgbLed init
11. e self number of leds if i led _led state i 3 CL RED red _led state i 3 CL GREEN green _led state i 3 CL BLUE blue sendColor led state ix 3 CL RED led state i 3 CL GREEN led state i 3 CL BLUE 2225 self sendColor red green blue 18 y seeed Grow the Difference amp Terminate data frame 32x 0 self sendByte 0x00 self sendByte 0x00 self sendByte 0x00 self sendByte 0x00 Note Use P9 22 UART2 RXD and P9 21 UART2 TXD as GPIO Connect the Grove Chainable RGB LED to UART Grove port of Beaglebone Green ae moin rgb led ChainableLED CLK PIN DATA PIN NUMBER OF LEDS while True 8 The first parameter NUMBER OF LEDS 1 Other parameters the RGB values rgb led setColorRGB 0 255 0 0 time sleep 2 rgb led setColorRGB 0 0 255 0 time sleep 2 rgb led setColorRGB 0 0 0 255 time sleep 2 rgb led setColorRGB 0 0 255 255 time sleep 2 rgb led setColorRGB 0 255 0 255 time sleep 2 rgb led setColorRGB 0 255 255 0 time sleep 2 rgb led setColorRGB 0 255 255 255 time sleep 2 Step4 Save the file by clicking the disk icon and giving the file a name with the py extension Step5 Connect Grove Chainable RGB LED to Grove UART socket on BBG Step6 Run the code You ll find the RGB LED is changing color every 2 seconds 19 y seeed Grow the Difference 4 Resources e Ch
12. in t 3 time sleep 5 pause so you can see what happened time sleep 2 print Test 4f Set using modulo every 3 offset 2 change color to magenta grovepi storeColor 255 0 255 time sleep 5 set every 4nd led to magenta Creve cihadnesileRgp lea module pin 2 3 time sleep 5 pause so you can see what happened time sleep 2 reset all off grov pi redeam onte exei xol test pin numilecds testColorslacik y seeed Grow the Difference time sleep 5 print Test 5a Set level 6 change color to green grovepi storeColor 0 255 0 time sleep 5 set leds 1 6 to green groyvepl write 120 block 0x04 95 pan 6 01 time sleep 5 pause so you can see what happened time sleep 2 reset all off grovapi chainablergoLecl test pin numlecds Stt olo lack time sleep 5 print Test 5b Set level 7 reverse change color to red grovepi storeColor 255 0 0 time sleep 5 set leds 4 10 to red groyvepil write 126e block 0x04 d ooo time sleep 5 except KeyboardInterrupt reset all off Grovyerr chained ler led test cin mumlede testColorslacik break except TOError print Niece 9 Notice that there s something you have to concern of pin 7 setting up the output pin numleds 1 Show many leds you plug Also all methods you can see in grovepi py is y seeed Grow the Difference storeColor red green blue chainableRgbLed init pin n
13. ovepi chainableRgbLed pattern pin thisLedAndInwards 2 time sleep 5 8 pause so you can see what happened time sleep 2 reset all off grovepi chainableRgbLed test pin numleds testColorBlack time sleep 5 print Test 3d Set using pattern this led and outwards 8 change color to green grovepi storeColor 0 255 0 time sleep 5 8 set leds 7 10 to green grovepi chainableRgbLed pattern pin thisLedAndOutwards 6 time sleep 5 11 y seeed Grow the Difference 8 pause so you can see what happened time sleep 2 reset all off grovepi chainableRgbLed test pin numleds testColorBlack time sleep 5 print Test 4a Set using modulo all leds amp change color to black fully off grovepi storeColor 0 0 0 time sleep 5 set all leds black offset 0 means start at first led 8 divisor 1 means every led grovepi chainableRgbLed modulo pin 0 1 time sleep 5 change color to white fully on grovepi storeColor 255 255 255 time sleep 5 8 set all leds white grovepi chainableRgbLed modulo pin 0 1 time sleep 5 8 pause so you can see what happened time sleep 2 amp reset all off grovepi chainableRgbLed test pin numleds testColorBlack time sleep 5 print Test 4lo Set using module every 2 change color to red grovepi storeColor 255 0 0 time sleep 5 set every 2nd led to red 1
14. umLeds chainableRgbLed test pin numLeds testColor chainableRgbLed pattern pin pattern whichLed chainableRgbLed modulo pin offset divisor chainableRgbLed setLevel pin level reverse 5 Run the demo sudo python grove chainable rgb led py 6 This demo may not work if your grovepi dosen t have the newest firmware update the firmware cd yourpath GrovePi Firmware sudo firmware update sh 3 3 With Beaglebone Green To begin editing programs that live on BBG you can use the Cloud9 IDE As a simple exercise to become familiar with Cloud9 IDE creating a simple application to blink one of the 4 user programmable LEDs on the BeagleBone is a good start If this is your first time to use Cloud9 IDE please follow this link Step1 Set the Grove UART socket as a Grove GPIO Socket just follow this link Step2 Click the in the top right to create a new file Cloud9 IDE R Nindow Help Preview Run Untitledi umm y seeed Grow the Difference Step3 Copy and paste the following code into the new tab import time import Adafruit BBIO GPIO as GPIO CLK PIN P9 22 DATA PIN P9 21 NUMBER OF LEDS 1 class ChainableLED 0 def init self clk pin data pin number of leds self clk pin clk pin self data pin data pin self number of leds number of leds GPIO setup self clk pin GPIO OUT GPIO setup self data pin GPIO OUT for i in range self number of leds

Download Pdf Manuals

image

Related Search

Related Contents

Stop insectes barrière 500ml biodegradable  Elo TouchSystems ET3239L User's Manual  Mode d`emploi 46 705 25C  Sunny Central and accessories  EGT 700 Garten-Kultivator Coltivatore da giardino Kultywator    Domo DO971T  Da-Lite Advantage Deluxe Electrol  Logiciel ELBASSIT Paie Bâtiment 1  Targus Leather Attaché Case  

Copyright © All rights reserved.
DMCA: DMCA_mwitty#outlook.com.