• Quick and dirty candle effect with PIC12F675

    For best results use a clear amber LED, you can embbed the LED using a tube as cast and pouring molten parafin...

    Code:
    '****************************************************************
    '*  Name    : RGB12F675                                         *
    '*  Author  : Ivan Rosales, Guadalajara México                  *
    '*  Notice  : Copyright (c) 2011 Ivan Rosales                   *
    '*          : All Rights Reserved                               *
    '*  Date    : 31/08/2011                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : Efecto de Vela en Pin 5 (GP2)                     *
    '*          : Utilizar preferentemente LED Ambar                *
    '****************************************************************
    @ Device PIC12F675,WDT_ON,PWRT_ON,PROTECT_OFF,MCLR_OFF,BOD_OFF
    ansel=0             'No usar ADC's las entradas serán digitales
    cmcon=7             'No usar comparadores analógicos
    trisio=%001011      'GP2 Será salida
    DEFINE OSCCAL_1K 1  'Auto-Calibración del reloj interno 
    
    'Definiciones
    Vela var GPIO.2
    Luz var byte
    X var byte
    Ciclos con 25
    
    'Programa
    Pral:
    random luz
    luz=luz//(255-ciclos)
    if luz<120 then luz=luz+50
    for x=1 to ciclos
    pwm vela, luz+x, 1
    next
    goto pral
    end
    This article was originally published in forum thread: Quick and dirty candle effect with PIC12F675 started by ivanrosales View original post