[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 580: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 636: sizeof(): Parameter must be an array or an object that implements Countable
Brads Electronic Projects Forum • PICnDuino used in mini fridge
Page 1 of 1

PICnDuino used in mini fridge

Posted: Mon Oct 14, 2013 6:15 am
by sdudley
Ok, so it is a shame to use such a powerful controller like the PICnDuino to handle a simple task, but it was a great way to get familiar with the PICnDuino and achieve a task at the same time.

This has been finished for quite some time but I finally got around to completing the video and didn't want to post on here until I had the video uploaded to youtube.

Here is the video...



The flash animation was done with the PIC and I used the Amicus IDE. This code is condensed from the actual code I uploaded to the PIC and I have not tested it but it should be fine. I noticed repetitive code in my original that was not necessary.

Code: Select all

'KISS logo - annimated sequence

'Set four ports to be used as outputs for the KISS logo
Dim LED0 As PORTB.0 
Dim LED1 As PORTB.1
Dim LED2 As PORTB.2 
Dim LED3 As PORTB.3
Dim flash As Dword                      'Create a word variable that will be used as a delay

While 1 = 1                             'Never end

   Dim returnToRepeat As Byte           'Create a byte variable
   Dim flashRoutine As Byte             'Create another...
   returnToRepeat = 2                   'Set the first variable so a repeat sequence will run X number of times
   flashRoutine = 6                     'Set the second variable so the entire routine will X number of times

'Main Program: 
loopSequence:                           'Label to be used to loop through a flashing sequence 
Repeat                                  
    High LED0                           'Set LED0 high
    For flash = 0 To 150000 : Next      'Create delay without using library call
    Low LED0                            'Set LED0 low
    
    High LED1                           'Set LED1 high
    For flash = 0 To 150000 : Next      'Create delay without using library call
    Low LED1                            'Set LED1 low
   
    High LED2                           'Set LED2 high
    For flash = 0 To 150000 : Next      'Create delay without using library call
    Low LED2                            'Set LED2 low

    High LED3                           'Set LED3 high
    For flash = 0 To 150000 : Next      'Create delay without using library call
    Low LED3                            'Det LED3 low
    
    Dec returnToRepeat                  'Decrement the repeat variable and return to do it again...
Until returnToRepeat = 0                'until it has been decremented to zero

    returnToRepeat = 2                  'Reset variable returnToRepeat
    
Repeat                                  'Repeat another sequence, only this time we will turn on all the LED's at the same time...
    High LED0
    High LED1
    High LED2
    High LED3
    For flash = 0 To 150000 : Next      'Hold them for a few...
    Low LED0                            'Now turn them all off again...
    Low LED1
    Low LED2
    Low LED3
    For flash = 0 To 150000 : Next      'Hold them for a few...
    
    Dec returnToRepeat                  'Decrement the repeat variable and return to do it again...
Until returnToRepeat = 0                'until it has been decremented to zero

    returnToRepeat = 2                  'Reset variable returnToRepeat
 
 
    Dec flashRoutine                    'Decrement the flashRoutine variable
If flashRoutine > 0 Then loopSequence   'Return to the beginning of the loop sequence if the flash routine is not finished  


stayOn:                                 'If the flash routine is satisfied, then turn on all lights indefinitely
    High LED0
    High LED1
    High LED2
    High LED3
GoTo stayOn

Wend                                    'END... No interupt needed, just reset the microcontroller to start over!
For the RGB LED's that were used to light the acrylic sign in the door, I used the Arduino side of the PICnDuino and although bitfogav gave me some good ideas to the color changing code, I actually ended up using something I found on adafruit. They have a great step by step tutorial for anyone who is interested in seeing it. The link is here:

http://learn.adafruit.com/rgb-led-strips/overview

Here they give you an overview, a schematic of the LED strips, how much current they will draw per meter, wiring them up, breadboarding a circuit, and the code to run them. The code is not as extravagant as other code I have seen, but it is simple enough to run through the colors and modify if you want to.

Anyway, sorry it took so long for me to finally respond but I have been busy with several other non-programming related projects, work, and life...

I also found a nice tutorial for beginners using the Amicus IDE, but I noticed there is no discussion for that on this forum so maybe I'll post another thread here in the PICnDuino area for those who are interested.

Enjoy,

Stacy

Re: PICnDuino used in mini fridge

Posted: Mon Oct 14, 2013 8:03 pm
by brad
Well done Stacy and friend!

The fridge came out a treat and you got to do some cool basic programming!

Glad to hear it came out just how you wanted and hope you guys had fun building the project. Now if only I could get around to actually completing one of my projects...

Re: PICnDuino used in mini fridge

Posted: Mon Oct 14, 2013 8:36 pm
by sdudley
One of the next mini fridge projects I plan to do is a League of Legends. I asked my son what he thought would be a cool video game theme (World of Warcraft, Halo, etc.). He suggested League of Legends because Riot games likes to highlight their community artwork, etc.

For that, it would be cool to make it interactive by painting the door to look like a screen shot of the game (with LED's placed throughout) and writing a program to make it appear as if the characters are battling.

Hmmm... Whatcha think?

Stacy

Re: PICnDuino used in mini fridge

Posted: Thu Oct 17, 2013 8:55 pm
by brad
Now that sounds like a programming project!

I have seen picture frames with water falls in them with lights in the back that give the illusion that the water is actually moving - would you be thinking something like that?

Re: PICnDuino used in mini fridge

Posted: Thu Oct 17, 2013 9:13 pm
by sdudley
That's just the kind of thing I am talking about. I think it would make a pretty cool mini fridge. :)

Stacy

Re: PICnDuino used in mini fridge

Posted: Sat Oct 19, 2013 8:03 pm
by brad
It's a good thing you have some spare PICnDuinos :)

Re: PICnDuino used in mini fridge

Posted: Sun Oct 20, 2013 12:35 am
by sdudley
brad wrote:It's a good thing you have some spare PICnDuinos :)
Sure, but what happens when I get requests for more fridges. There are only a finite number of PICnDuinos available. I guess that will make these mini fridges very rare collectable items someday!

WhooHoo :!:

Stacy

Re: PICnDuino used in mini fridge

Posted: Mon Oct 21, 2013 8:29 pm
by brad
They will be rare! Or are you hinting that I need to make more PICnDuinos... hmm...

Re: PICnDuino used in mini fridge

Posted: Mon Oct 21, 2013 9:13 pm
by sdudley
brad wrote:They will be rare! Or are you hinting that I need to make more PICnDuinos... hmm...

Hmmm... :roll: I wonder...