Anyone used smart leds with APA102/SK9822 controller, with Picbasic ?


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,078

    Default Anyone used smart leds with APA102/SK9822 controller, with Picbasic ?

    Hello.
    These leds while delivering neopixel led like functionality, run on more common, SPI interface, with much more relaxed timing requirements. So they should be easier to use.
    Search delivers no results, does anyone tried to used them with PBP?

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Anyone used smart leds with APA102/SK9822 controller, with Picbasic ?

    Quote Originally Posted by CuriousOne View Post
    Hello.
    These leds while delivering neopixel led like functionality, run on more common, SPI interface, with much more relaxed timing requirements. So they should be easier to use.
    Search delivers no results, does anyone tried to used them with PBP?
    I use them a lot. Easy to use in PBP, here some test blinks:
    Code:
    '****************************************************************
    '*  Name    : APA LED                                           *
    '*  Author  : Louis                                             *
    '*  Notice  : Copyright (c) 2020                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 7. 10. 2020                                       *
    '*  Version : 1.0                                               *
    '*  Notes   :                                                   *
    '*          : PIC 12F1840                                       *
    '****************************************************************
    #CONFIG
      __config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_ON & _FCMEN_ON
      __config _CONFIG2, _WRT_OFF & _PLLEN_ON & _STVREN_ON & _BORV_19 & _LVP_OFF
    #ENDCONFIG
    
    DEFINE OSC 4                ; Use internal clock 4MHz 
    OSCCON  = %01101010         ; 4 MHz internal
    OSCTUNE	= %00000000	        ; Internal osc tunning
    
    WHILE !OSCSTAT.3	; Wait for stable OSC 
    WEND
    
    TRISA = %100100             ; RA.2, RA.5 input rest output
    ANSELA = %00000  
    OPTION_REG.7=1              ; disable internal pull-ups
    
    INCLUDE "modedefs.bas"
    
    di       var porta.1      
    ci       var porta.4
    
    r var byte 
    g var byte 
    b var byte 
    n var byte 
    nn var byte
    cyc var byte
    clear
    
    gosub clear_strip           ; clear strip       
      
    main:
    
    gosub white_fade 
    pause 1000
    gosub police_blink
    pause 1000
    gosub color_blink
    pause 1000
    gosub Orange_Breathe
    pause 1000
    gosub Red_flicker
    pause 1000
    
    goto main
    
    ; -------     BLINK CODES      --------  
    police_blink:
    gosub clear_strip
    led:
    gosub start_frame
    for nn=0 to 2
    gosub start_frame
    r=250:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=250:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=0:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=0:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    gosub start_frame
    pause 30
    gosub clear_strip
    pause 30
    next nn : nn=0
    
    pause 100
    
    for nn=0 to 2
    gosub start_frame
    r=0:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=0:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=0:g=0:b=250:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=0:g=0:b=250:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    gosub start_frame
    pause 30
    gosub clear_strip
    pause 30
    next nn : nn=0
    
    pause 100
    return
    ; --------- END of police Blink ----------
    
    ; ---------   Color Blink ----------
    color_blink:
    gosub clear_strip
    leds:
    gosub start_frame
    for nn=0 to 5
    gosub start_frame
    r=250:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=150:g=50:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=250:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=150:g=50:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    gosub start_frame
    pause 30
    gosub clear_strip
    pause 30
    next nn : nn=0
    
    pause 100
    
    for nn=0 to 5
    gosub start_frame
    r=0:g=50:b=10:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=0:g=200:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=0:g=50:b=10:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    r=0:g=200:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    gosub start_frame
    pause 30
    gosub clear_strip
    pause 30
    next nn : nn=0
    
    pause 100
    
    return
    ; --------- END of color Blink ----------
    
    ; ---------      White Fade     ----------
    white_fade:
    gosub clear_strip
    gosub start_frame
    
    lit_up:
    for nn=0 to 3
    r=255:g=255:b=255:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    next nn : nn=0
    gosub start_frame
    
    for cyc = 0 to 254 
    r=r-1:g=g-1:b=b-1
    for nn=0 to 3
    SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    next nn : nn=0
    gosub start_frame
    next cyc  : cyc=0
    return
    ; --------- END of White Fade ---------
    
    ; ---------   Orange Breathe  ---------
    Orange_Breathe:
    gosub clear_strip
    gosub start_frame
    
    for cyc = 0 to 24
    pause 30 
    r=r+10:g=g+1:b=0
    for nn=0 to 3
    SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    next nn : nn=0
    gosub start_frame
    next cyc : cyc=0 
    
    pause 300
    
    for cyc = 0 to 24
    pause 30
    r=r-10:g=g-1:b=0
    for nn=0 to 3
    SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    next nn : nn=0
    gosub start_frame
    next cyc  : cyc=0
    glow_up:
    gosub start_frame
    for nn=0 to 4
    r=10:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    next nn : nn=0
    return
    
    ; ------- END of Orange Breathe -------
    
    ; ---------      Red flicker     ----------
    Red_flicker:
    gosub clear_strip
    gosub start_frame
    
    flicker:
    for nn=0 to 3
    r=255:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    next nn : nn=0
    gosub start_frame
    
    pause 500
    
    for cyc=0 to 10
    gosub start_frame
    for nn=0 to 3
    r=255:g=0:b=0:SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    next nn : nn=0
    pause 50
    gosub clear_strip
    pause 50
    next cyc : cyc=0
    return
    ; --------- END of Red flicker  ---------
    
    ; --------- Blink subroutines ----------
    start_frame:
    SHIFTOUT di, ci, 1, [%00000000,%00000000,%00000000,%00000000]
    return
    
    clear_strip:
    SHIFTOUT di, ci, 1, [%00000000,%00000000,%00000000,%00000000]
    for n=0 to 4
    r=0:g=0:b=0
    SHIFTOUT di, ci, 1, [%11100111,b,g,r]
    next n : n=0
    return
    ; ---------- END of Blink Subroutines -----------

  3. #3
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: Anyone used smart leds with APA102/SK9822 controller, with Picbasic ?

    Thanks!
    Will order some and let them go

  4. #4
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: Anyone used smart leds with APA102/SK9822 controller, with Picbasic ?

    Tried it now with single led, it works!
    Thanks again

Similar Threads

  1. Replies: 0
    Last Post: - 5th June 2012, 09:43
  2. Clock for smart card
    By aherrera in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th August 2011, 17:34
  3. rs485 to rs232 smart switch
    By RSSHARPE in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th June 2004, 09:44
  4. Smart Card Envelope
    By Art in forum Schematics
    Replies: 0
    Last Post: - 8th August 2003, 20:15

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts