Holiday gift for the forum!


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2010
    Location
    Chile
    Posts
    25

    Default Holiday gift for the forum!

    My gift to the forum this holidays...



    Your own PicBasic controlled Christmas POV tree.

    Good for gift, tabletop or office decoration.
    Also as a starter kit for surface mount soldering (original purpose)

    Here's the code, really basic.
    Anyone for a different sequence routine? post it and i'll test them.

    Code:
    '__config _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_ON & _PWRTE_ON & _INTRC_OSC_NOCLKOUT
    
    ' --------------------
    ' CONFIGURATION
    ' -----------------
    
    define OSC 4 'Clock in MHz
    
    ' ---General Settings
    
    CMCON = %00000111         'all digital and off comp for low power use
    VRCON = 0                 'Vref apagado
    
    
    ' ---ADC Settings 'Comment for 12F628
    'ADCON0 = 0 'ADC Off
    'ANSEL = 0
    
    'ADCON0 = %10000001 ' Seleccion de justificacion y habilitacion de ADC  (RGHT JUST,ADC Enable)
    'ANSEL  = %00100011      ' Seteo inicial de reloj %x6543210 [6:4] CLK=Fosc/32, [3:0] ADC CHannel Enable
    
    'DEFINE ADC_BITS 10     ' ADCIN resolution  (Bits)     se usan para PBP si uso un clock distinto a RC
    'DEFINE ADC_CLOCK 2     ' ADC clock source  (Fosc/32)
    'DEFINE ADC_CLOCK 3    ' ADC clock source  (RC)
    'DEFINE ADC_SAMPLEUS 15 ' ADC sampling time (uSec)
    
    ' ---PORT Settings
    
    TRISIO = %001000	'TRISIO = %xx543210   GPIO.3 solo input
                        'Pone entradas y salidas en I/O
                        'Orden: Ax-A0  (1:entrada 0:salida)
    GPIO = 0
    
    OPTION_REG.7 = 1 ' Pull-UP en GPIO (0=enable 1=disable)
    WPU = %000000    ' WPU = %xx54x210 
                     ' Selecion de puertos para Weak Pull-Ups  (1:on 0:off)
    
    
    '-- PORT Naming
    
    Led0  VAR GPIO.0  'up on the tree
    Led1  VAR GPIO.1
    Led2  VAR GPIO.2
    But0  VAR GPIO.3   'just input, no WPU
    Led4  VAR GPIO.4   
    Led3  VAR GPIO.5  'down on the tree 
    
    
    ' ---Variables declaration
    
    '--Variables general use
    X       VAR     BYTE  ' Uso comun 
    Y       var     byte
    Z       var     byte
    t       VAR     byte
    n       VAR     BYTE      
    wX      VAR     word   
    wY      VAR     word    
    wZ      VAR     word
    
    Mode var byte
    
    
    ' --------------------
    ' MAIN CODE
    ' -----------------
    
    main:
    
    if but0 = 0 then   'not used yet
        mode = mode + 1
        if mode = 4 then mode = 0
    endif 
    
    led0 = 1  'green
    led1 = 0  'blue
    led2 = 1  'green
    led3 = 0  'blue
    led4 = 1  'green
    pause 3           'good delay for dots
    
    led0 = 1  'green
    led1 = 1  'green
    led2 = 1  'green
    led3 = 1  'green
    led4 = 1  'green
    pause 7
    
    led0 = 0  'blue
    led1 = 1  'green
    led2 = 0  'blue
    led3 = 1  'green
    led4 = 0  'blue
    pause 3
    
    led0 = 1  'green
    led1 = 1  'green
    led2 = 1  'green
    led3 = 1  'green
    led4 = 1  'green
    pause 7
    
    goto main
    
    
    end
    Takes about one afternoon to make
    Full instructions on this link:
    http://www.instructables.com/id/POV-Chistmas-Tree/
    "If at first doesn't work, kicking it wont help either"

  2. #2
    Join Date
    May 2010
    Location
    Chile
    Posts
    25


    Did you find this post helpful? Yes | No

    Default

    Video of the tree working with this sequence:



    Video recorders "hate" POV displays, but nice eyecandy anyway.
    "If at first doesn't work, kicking it wont help either"

  3. #3
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default

    Very cool, Thank you. Maybe I need to make 1 for next year.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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