Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using PWM on a 18F13K22

Status
Not open for further replies.

MrDEB

Well-Known Member
Working on a simulated candle that flickers as per real candle. Using swordfish I got this code working BUT the results look more like a strobe light (using a 18F2420 for test of code at present) and thinking perhaps a PWM output would be better. Well the 18F2420 only has two PWM outputs but I can't get the second one to work (using the PWM2 module).
In the final design I am using a 18F13K22(cost was deciding factor as I am planning on 15 of these candles) which has 4 PWM outputs. Just need to breadboard a circuit and test but how to implement the PWM2 module for 3 outputs as in my proposed schematic. Didn't realize the 18F13K22 has 4 PWM outputs until I received in the mail yesterday and getting ready to breadboard said pic. ANY suggestions on either slowing down the present code so it doesn't look like a strobe light and/or using the PWM2 module on the 18F13K22. NOTE the data sheet mentions pullup or pull-down on the outputs but using the N mosfets should take care of this?
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                  *
*  Author  : [select VIEW...EDITOR OPTIONS]                                *
*  Notice  : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 11/18/2013                                                    *
*  Version : 1.0                                                            *
*  Notes  :                                                                *
*          :                                                                *
*****************************************************************************
}
{
*****************************************************************************
*  Name    : candle routine.BAS                                                  *
*  Author  : Doug Bezaire                                                  *
*  Notice  : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 4/1/2010                                                      *
*  Version : 1.0                                                            *
*  Notes  :                                                                *
*          :                                                                *
*****************************************************************************
}
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                  *
*  Author  : Doug Bezaire                                                  *
*  Notice  : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 3/26/2010                                                      *
*  Version : 1.0                                                            *
*  Notes  :                                                                *
*          :                                                                *
*****************************************************************************
}
Device = 18F2420
Clock = 8

Include "InternalOscillator.bas"
Include "RandGen.bas"
Include "Utils.bas"
Dim TMR2IE As PIE1.1,        // TMR2 interrupt enable
    TMR2IF As PIR1.1,        // TMR2 overflow flag
    TMR2ON As T2CON.2,        // Enables TMR2 to begin incrementing
    Signal_Pin As PORTB.0    // Signal output to frequency meter
Dim Red_Pin As PORTA.2,        //was b.0
    Green_Pin As PORTA.0,      //was b1
    Blue_Pin As PORTA.1,        //was b2
    Red_Duty As Byte,
    Green_Duty As Byte,
    Blue_Duty As Byte,
    Red_DutyVal As Byte,
    Green_DutyVal As Byte,
    Blue_DutyVal As Byte,
    RandomVal As Byte
 
Dim uS As Word,
    mS As Word         
  // ranval(1)as word
Interrupt TMR2_Interrupt()
    High(Signal_Pin)
    Save(0)                  // Back up system variables 
    If TMR2IF = 1 Then        // Check if the interrupt was from TMR2 
        TMR2IF = 0            // Clear the TMR2 interrupt flag
        uS = uS + 50
        If uS >= 1000 Then
            uS = uS - 1000
            Inc(mS)
        EndIf     
        Inc(Red_DutyVal)
        Inc(Green_DutyVal)
        Inc(Blue_DutyVal)
        If Red_DutyVal > Red_Duty Or Red_Duty = 0 Then
            Red_Pin = 0
        Else
            Red_Pin = 1
        EndIf
        If Green_DutyVal > Green_Duty Or Green_Duty = 0 Then
            Green_Pin = 0
        Else
            Green_Pin = 1
        EndIf
        If Blue_DutyVal > Blue_Duty Or Blue_Duty = 0 Then
            Blue_Pin = 0
        Else
            Blue_Pin = 1
        EndIf             
    EndIf                    //
    Restore                  // Restore system variables
    Low(Signal_Pin)
End Interrupt
Private Sub TMR2_Initialize()
    TMR2ON = 0                // Disable TMR2
    TMR2IE = 0                // Turn off TMR2 interrupts 
    PR2 = 149                // TMR2 Period register PR2
    T2CON = %00000001        // T2CON 0:1 = Prescale
                              //        00 = Prescale is 1:1
                              //        01 = Prescale is 1:4
                              //        1x = Prescale is 1:16                               
                              //      3:6 = Postscale             
                              //    0000 = 1:1 postscale
                              //    0001 = 1:2 postscale
                              //    0010 = 1:3 postscale...
                              //    1111 = 1:16 postscale
    TMR2 = 0                  // Reset TMR2 Value 
    TMR2IE = 1                // Enable TMR2 interrupts
    TMR2ON = 1                // Enable TMR2 to increment
    Enable(TMR2_Interrupt)
End Sub
// Start Of Program...
Low(Red_Pin)
Low(Green_Pin)
Low(Blue_Pin)
Red_Duty = 255
Green_Duty = 0
Blue_Duty = 0
Red_DutyVal = 0
Green_DutyVal = 0
Blue_DutyVal =0
uS = 0
mS = 0

RandGen.Initialize(128)      // Initialize the Random Number generator
TMR2_Initialize              // Setup and enable TMR2
While True                    // Create an infinite loop
    RandomVal = RandGen.Rand  // Grab a random number from 0 to 255
    // Select RandomVal        // Find out what colour to increase/decrease
        //Case 0 To 42
            Red_Duty =RandomVal-5
                //mS = 0
            // (Red_Duty)=Rand(1)
              // Repeat
              // Until mS = 19
              // and Red_Duty>0
          // endif
         
           
        //Case 43 To 84
            If Red_Duty > 0
              Then  mS = 0
                Repeat
                Until mS = 20
                Dec(Red_Duty)
                DelayMS(5000)
            EndIf
      // Case 84 To 127
            Green_Duty =RandomVal-20
              //Then  mS = 0
              //  Repeat
              //  Until mS = 19
              //  Inc(Green_Duty)
          // EndIf
      // Case 128 To 170
            If Green_Duty > 0
              Then  mS = 0
                Repeat
                Until mS = 40
                Inc(Green_Duty)
                DelayMS(5000)
            EndIf
      //  Case 170 To 212
            Blue_Duty = RandomVal-30
            // Then  mS = 0
              //  Repeat
              //  Until mS = 19
              //  Inc(Blue_Duty)
          // EndIf
      // Case 212 To 255
            If Blue_Duty > 0
              Then  mS = 0
                Repeat
                Until mS = 20
                  DelayMS(5000)
                Inc(Blue_Duty)
            EndIf
            Wend
         
        End
 

Attachments

  • PWM outs.png
    PWM outs.png
    19.1 KB · Views: 432
you sure its 4 modules and not 4 outputs?
 
ok only had a speed read at the datasheet but i am 99.99% sure it isnt going to do what you have planned, the pwm outputs are not individual! they are tied to one enhanced pwm module and are meant for full H bridge/half H bridge configurations, what it wont do is output different duty cycles at the same time, for that you would need 4 modules, off the top of my head the closest small 18f chip that would do what you want is 18f1330 that has three wich is enough for RGB. Having broken the bad news i can however offer you hope :D the chip you have has 4 timers so software pwm is the way to go with this chip.

edit
one small point when i click on your drawing i cant read it properly it dosnt show up very well. also a small point but i found it a bit confusing with the bus line drawn like that, it makes it look like they are all tied to the same points so they will all be doing the same thing at the same time! candles arnt like that, i would have thought you want them out of sync for best effect, anyway its a small thing but i found your drawing hard to read its all blury

edit 2
ive got it now! you have drawn each led as three individual leds! and i take it they are common Anode type?
 
Last edited:
I may have hit on a different approach using this code
Code:
Device = 18F2420
Clock = 8

Include "InternalOscillator.bas"
Include "RandGen.bas"
Include "Utils.bas"
  Const led(30) As Byte = (%11111100, %11111100, %11111100, %11111100, %11111100, %11111011,
                          %11111000, %11111100, %11111100, %11111100, %11111100, %11111011,
                          %11111100, %11111100, %11111000, %11111100, %11111100, %11111011,
                          %11111100, %11111100, %11111100, %11111100, %11111100, %11111011,
                          %11111100, %11111100, %11111100, %11111000, %11111100, %11111011 )
  Dim INDEX As Byte
  Dim x As Byte
    Dim LED1 As PORTA
   
    Dim RANDONVAL As Byte
  Sub flicker()
  'DIM X AS BYTE
        For x = 0 To 29
        RANDONVAL = RandGen.Rand
        PORTA = led(x)
        DelayMS(RANDONVAL)
        Next
    End Sub
    ' START OF PROGRAM
  INDEX = 0 
TRISA = %00000000   
SetAllDigital
RandGen.Initialize(255)   
    While true
          flicker
        'LED1 = %00000111
        ' DelayMS(100)
          'LED1 = %00000011
          'DelayMS(100)
 
    Wend
By adjusting the colors to help eliminate the strobe effect then use a mosfet on the anode and PWM on the common anode for the flicker effect?. I was hoping the PWM would be different on each channel. Perhaps I am mistaken.
I will upload a revised and larger schematic.
 
sorry but you have confused me! from your drawing it looks like you are using mosfet with a presume pwm to each CATHODE and it looks like the common ANODE is just tied straight to VCC, i dont do basic so cant comment on the code, but i got the impression from what you had said that each mosfet would be run from a different pwm channel??
And that was the reason you got the chip you did because you thought it had 4 individual pwm outputs? (is that correct?). if so then you have a misunderstood the pwm on that chip, it dosnt have 4 individual pwm chanels, it has a single enhanced pwm module with 4 outputs! its for driving a H bridge half or full, or to put it another way it wont give you different duty cycles on each led pin at the same time, wich i assume you want for a RGB led???
OR
you dont actually need that and your only lighting one channel at a time (say red then green then blue)?? if your just trying to get very low frequency on/off for a flicker then you dont need pwm at all just stick a loop in the code that every n times round turns led on then slightly shorter time turn led off.
can you describe exactly what you want the chip to do? hopefully in a way that me as a novice can grasp. many thanks
LG

edit

see what is in my head is you have a RGB led according to your drawing its common ANODE, and you want it to look like a candle?

so your looking to pwm the channels to make different yellows and oranges and that kinda colour (like a candle) also while you have that going on you want the led to flicker?

if thats so then at present your drawing isnt correct

you would need a pwm on each colour channel, this will give you the different yellows etc
then on the common ANODE you need a low frequency flicker effect??
i am correct so far?

if you dont want to use software pwm for the colours of the candle then you need a chip like the 18f1330 to take care of the pwm on each colour channel for you and just have a loop in the program tied to the ANODE that randomly turns it on and off for say 750ms every few seconds (of course you very the lengh and time for a flicker)
 
Last edited:
I didn't know the 18F13K22 had 4 PWM outputs but have a second though on how to maybe make this work as wanted.
Using the posted code which basically turns on each color (RED, GREEN, BLUE) but the result looks more like a strobe light. I tried changing the amount of time on but found using mostly BLUE mixed with GREEN at a delayms of 1000mili seconds (1 second) or less seems to look ok then occasionally throw a red into the mix. The result looks ok but maybe adding the PWM on the anodes might induce a better flicker? Need to do some experimenting.
Here is hopefully a better schematic.
PWM outputrev2.png
 
no the drawing is rubbish still BRB

edit

ok first off drop the bus thing it just gets confusing and on a drawing that should be as simple as that it isnt needed.

next point

you havnt answered what i asked?? are you trying to make the colours of a candle (yellows,oranges etc?) or are you trying to just get blue,red,green to flash?

if your trying to make colours then you need to pwm each colour channel of the led (forget flickering for a min) that is how a RGB led works, you adjust the duty cycle of each colour channel to make another colour, this is normally done at rates of more than 100Hz so it dosnt flicker (not your kind of flickering the other kind).

next point YOUR CHIP DOES NOT have 4 separate pwm channels they are tied together for motor control, i dont want to go into it but the datasheet has the info, simply trust me on this that chip will not be able to pwm each colour channel with the pwm module.

next point for flickering you DO NOT WANT pwm for the flickering, its too fast, you want random on and off.

SOLUTION

software pwm for each colour channel using 2 timers for best effect but you could use one timer, then just have each ANODE connected to a pin that every n number of times the programs loops it will random flash for the flickering. also on your drawing you are using (or it looks like it but hard to read on my screen) the LV PGM pin so make sure that is configured correctly.
 
Last edited:
Little Ghostman is spot-on in everything he's saying.

1. If you randomly vary the levels for the red, green and blue LEDs, you'll make every color in the rainbow. It won't look like a candle at all. The colors of a candle wil be a narrow range of yellow-orange colors. Look at the RGB color chart here.

2. PWM isn't what you need to create the flicker look, and it's not what your old code did. Your old code used timers to create the illusion of flickering. What you can do with PWM is to control the color of the RGB LED. Regardless of whether a chip can support 4 independent channels of PWM, Swordfish Basic only supports two. You might fix one of the colors by selection of the appropriate current limiting resistor, and the use PWM on the other two colors to vary the resulting color over the narrow range needed to look like a candle flame. Independently, you could use the timer routines of your old code to create flicker. It won't look very realistic to have all three candles you hope to drive off one micro vary color at the same time.

3. There's pages of forum posts here where people helped you post clear schematics. Find it and follow it again.[/B]
 
The last code I posted is one that I wrote for experimenting with an out of the box idea that kinda works but not a true flicker. Going back to my original code and perhaps as suggested use the PWM on one or two colors. ot sure what path but will try anything once. As for the posting of schematics, the image looks good in preview but ?? In the last post I used infaview and increased the resolution. Will do a search on privious thread.
 
I just found an issue using PWM, the RGB leds are common ANODE thus controlling one color with PWM is not doable ?? unless perhaps use a mosfet on the low side of the red cathode?
Will get back after I figure out and follow the recommendations.
 
A PWM pin on a PIC18F-series micro is like any other port pin. It can source or sink 25 mA. You just need to understand (oops, there's that word again) the 100% on when sinking current = 100% off when sourcing current.

By the way, your last schematic shows 3 LEDs in parallel...keep the 25 mA limit in mind.
 
ok hold it there! you did NOT find an issue! actualy i pointed out that you had drawn common ANODE in my first or second post! and it makes no difference if you pwm ANODE or CATHODE , you need to stop what your doing take a deep breath and lets start again! i will be back but i need a little time <1hour because i clearly need to post a big post to sort this random going around in circles out!
 
I am going back to my orginal code and disect as to what it is actually doing. I found that by changing the post scale I was able to slow down the flashing thus more of a flicker. NOW the interesting part. see code remarks. NOTE I tested portB.3 before inserting into code as led. Going to try as suggested by running the code as is but ocassionally insert a flicker (enable the red led for a delayms(1000).
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                  *
*  Author  : [select VIEW...EDITOR OPTIONS]                                *
*  Notice  : Copyright (c) 2013 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 11/18/2013                                                    *
*  Version : 1.0                                                            *
*  Notes  :                                                                *
*          :                                                                *
*****************************************************************************
}
{
*****************************************************************************
*  Name    : candle routine.BAS                                                  *
*  Author  : Doug Bezaire                                                  *
*  Notice  : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 4/1/2010                                                      *
*  Version : 1.0                                                            *
*  Notes  :                                                                *
*          :                                                                *
*****************************************************************************
}
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                  *
*  Author  : Doug Bezaire                                                  *
*  Notice  : Copyright (c) 2010 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 3/26/2010                                                      *
*  Version : 1.0                                                            *
*  Notes  :                                                                *
*          :                                                                *
*****************************************************************************
}
Device = 18F2420
Clock = 8

Include "InternalOscillator.bas"
Include "RandGen.bas"
Include "Utils.bas"
'Include "PWM2.bas"
Dim TMR2IE As PIE1.1,        // TMR2 interrupt enable
    TMR2IF As PIR1.1,        // TMR2 overflow flag
    TMR2ON As T2CON.2,        // Enables TMR2 to begin incrementing
    Signal_Pin As PORTB.0    // Signal output to frequency meter

Dim Red_Pin As PORTA.2,        //was b.0
    Green_Pin As PORTA.0,      //was b1
    Blue_Pin As PORTA.1,        //was b2
    Red_Duty As Byte,
    Green_Duty As Byte,
    Blue_Duty As Byte,
    Red_DutyVal As Byte,
    Green_DutyVal As Byte,
    Blue_DutyVal As Byte,
    RandomVal As Byte
    'xxxxxxxxxxxxxxxxxxxxx
Dim led As PORTB.3            // testing progress
'xxxxxxxxxxxxxxxxxxxxxxxxxxx 
Dim uS As Word,
    mSa As Word // changed to msa thinking perhaps it was messing with delayms
'dim duty as byte         
  // ranval(1)as word
Interrupt TMR2_Interrupt()
    High(Signal_Pin)
    Save(0)                  // Back up system variables 
    If TMR2IF = 1 Then        // Check if the interrupt was from TMR2 
        TMR2IF = 0            // Clear the TMR2 interrupt flag
        uS = uS + 1000
        If uS >= 1000 Then
            uS = uS - 1000
            Inc(mSa)
        EndIf     
        Inc(Red_DutyVal)
        Inc(Green_DutyVal)
        Inc(Blue_DutyVal)
        If Red_DutyVal > Red_Duty Or Red_Duty = 0 Then
            Red_Pin = 0
        Else
            Red_Pin = 1
        EndIf
        If Green_DutyVal > Green_Duty Or Green_Duty = 0 Then
            Green_Pin = 0
        Else
            Green_Pin = 1
        EndIf
        If Blue_DutyVal > Blue_Duty Or Blue_Duty = 0 Then
            Blue_Pin = 0
        Else
            Blue_Pin = 1
        EndIf             
    EndIf                    //
    Restore                  // Restore system variables
    Low(Signal_Pin)
End Interrupt
Private Sub TMR2_Initialize()
    TMR2ON = 0                // Disable TMR2
    TMR2IE = 0                // Turn off TMR2 interrupts 
    PR2 = 149                // TMR2 Period register PR2
    T2CON = %00000000        // T2CON 0:1 = Prescale
                              //        00 = Prescale is 1:1
                              //        01 = Prescale is 1:4
                              //        1x = Prescale is 1:16                               
                              //      3:6 = Postscale             
                              //    0000 = 1:1 postscale
                              //    0001 = 1:2 postscale
                              //    0010 = 1:3 postscale...
                              //    1111 = 1:16 postscale
    TMR2 = 0                  // Reset TMR2 Value 
    TMR2IE = 1                // Enable TMR2 interrupts
    TMR2ON = 1                // Enable TMR2 to increment
    Enable(TMR2_Interrupt)
End Sub
// Start Of Program...
Low(Red_Pin)
Low(Green_Pin)
Low(Blue_Pin)
Red_Duty = 10
Green_Duty = 10
Blue_Duty = 10
Red_DutyVal = 0
Green_DutyVal = 0
Blue_DutyVal =0
uS = 0
mSa = 0

RandGen.Initialize(128)      // Initialize the Random Number generator
TMR2_Initialize              // Setup and enable TMR2
'xxxxxxxxxxxxxxxxxxxxxxxthe following never implements. changed location but no change?
led = 1    ' port B.3 for testing code progress
DelayMS(2000)
' led=0
'delayms(2000)
'xxxxxxxxxxxxxxxxxxxxx


While True                    // Create an infinite loop
    RandomVal = RandGen.Rand  // Grab a random number from 0 to 255
    // Select RandomVal        // Find out what colour to increase/decrease
        //Case 0 To 42
            Red_Duty =RandomVal-15
                //mS = 0
            // (Red_Duty)=Rand(1)
              // Repeat
              // Until mS = 19
              // and Red_Duty>0
          // endif
       
           
        //Case 43 To 84
            If Red_Duty > 0
              Then  mSa = 0
                Repeat
                Until mSa = 10
             
         
         
               
                Inc(Red_Duty)
              ' DelayMS(5000)
            EndIf
      // Case 84 To 127
            Green_Duty =RandomVal-25
              //Then  mS = 0
              //  Repeat
              //  Until mS = 19
              //  Inc(Green_Duty)
          // EndIf
      // Case 128 To 170
            If Green_Duty > 0
              Then  mSa = 0
                Repeat
                Until mSa = 10
                Inc(Green_Duty)
              '  DelayMS(5000)
            EndIf
      //  Case 170 To 212
            Blue_Duty = RandomVal-35
            // Then  mS = 0
              //  Repeat
              //  Until mS = 19
              //  Inc(Blue_Duty)
          // EndIf
      // Case 212 To 255
            If Blue_Duty > 0
              Then  mSa = 0
                Repeat
                Until mSa = 10
                ' DelayMS(5000)
                Inc(Blue_Duty)
            EndIf
         
            Wend
         
        End
 
because many many people give up there time to help me and teach me stuff i wont to help you, i cant code in swordfish basic i tried it and hated it! but code is code dosnt matter what language all you got to do is mimic what the code is doing, but first you are not at the code stage yet! you have missed bits and this i can help with.
so using stuff i have learnt here, i offer the Logan guide to almost pain free projects! first off you got to plan the project, no good waking up and saying you know what i am going to make a candle then jump straight onto google and type candle code in swordfish basic! then jump onto the supplier website and filter chips by price and pick the first that looks like it will have what you want. SIMPLY because at the point you decide you want to do a project you have zero information.
so first is information gathering

1. decide what you actualy want..... in your case decide if you want a led to mimic a candle or a led to flash random colours somehow.

2. then think about how it could be done, in your case pwm for colour seems logical so thats the colour part taken care of. if you want to mimic random led flashing then your almost there, if you want to mimic a candle your not almost there.

3. you have to know what your trying to mimic and how close to the real thing you want to get, for example lets say you want to paint a portrait, two ways to do it, first way like the mad impressionist's where they draw the faces out of triangles and squares and squiggles and you have to stand on your head to make out that it might be a face or you can do it like one the great portrait artist that paint as if they have taken a photograph, but its important to decide at the start what the finished project will be. again to drum this point home say you want to build a PSU you cant just go order some bits and stick it altogether, you would need to decide what voltages you want, do you want 1,2,3,4,5V or do you want 1-5V with 1mVsteps??
do you see what i am getting at? define your project goals at the start and unless there is a good design reason try and stick with the design goal, every time you change the design goal you are in effect starting a new project from scratch.

4. once you are sure you know what it is you want to build you have to understand it, for example if your going to mimic a candle then make sure you know what a candle does! sounds silly but think about it, we have been talking about flickering etc but really a candle rarely flickers as such, i have just lit one and yes to start with it flickered (take a note when it starts up make your candle flicker) but then it settled and just kind of change slightly in colour and intensity more of a gentle up and and down kind of thing with the very occasional flicker and more wild colour change,
note the colours, i saw mainly yellow's (loads of them) a few oranges, a very almost non existent red and a light blue at the center.

5. so now you know what you want plan out the ways this could be done, in your case pwm of a rgb seems obvious but there are other way's, lets stick to pwm for the colour for now.

6. decide how you will do this!! KEEP IN MIND YOUR Limitation's no point designing something you have no hope of building, only design something if you can tick one of the following

a) i can build it with some help and guidance but with me doing most the work (this means you are at the mercy of others tho and you have to be prepared to do thing's there way not your's) the reason being you are asking someone to help design and build something that requires someone else to spend there TIME and EFFORT doing, in the real world you normally have to pay a consultant shed loads but because your paying you have the right to call the shots and have the design built to your spec, if your not paying then you only have the right to hope someone will offer help and guidance but in return the price you pay is one of compromise between getting what you want your way and getting what you want done some other way.

again another way of looking at it is how dad explained it to me, you go into a restaurant and you order a steak, you say to the man i want my steak cooked like this (insert how you like your steak) the man goes and tells another man who coocks it the way you want, you eat it and then pay the nice man for the steak.

OR your skint! and live rough, so you walk past the restaurant go around the corner to the soup kitchen (in this case ETO) where the professional cook's have very kindly decided that once in a while they will go share there skill's with those that cant afford to pay for them and they cook stuff for poor people to eat) at the soup kitchen (ETO) you stand in a line and wait for your turn where a nice man/woman say's hello, at this point you DO NOT behave in a RUDE way and say go tell the chef i want a rump steak and i want it cooked so rare that if a good vet couldn't save it then it's overcooked! you say politely hi i am hungry and would like some food if you could spare some, the nice man/woman goes and get's a plate/bowl of whatever the other nice man/woman has cooked and gives it to you FREE OF CHARGE, because your hungry have no food and cant cook your very greatful!

b) you have a pretty good idea what your doing and just need to check a couple of things you are unsure about, this means you pretty much have done it or have it all planed ready to go and want to check a couple of technical aspects, so you say this is what i am doing this is how i am doing it but can i also do/add XYZ?? someone pops up and say yes/no and you go away with the answer and do the project

c) you know exactly what your doing, you are a pro, the kind of person that gives up some there time to help others do there projects, you dont need help you have the project under controll you know what your doing, if you tick this box stop wasteing time and go do it!


ok lets assume you have ticked a box. next job is to work out as far as you can how you think you can do it, you make a list of the bits you need help with (be specific) you have done a schematic! at this point i will point out that i will do another post regarding drawings! no offense meant but yours are kinda like the ones my 4 year old sister does in the back of my school books! anyway get those bits sorted and come back!

see what i mean we are nowhere near ready to think code
 
how can you start doing code before you know what your trying to get it to do?:confused::eek:
 
see this is what i was talking about when i said they didnt flicker but kind of varied intensity
 
what are you going to house the LEDS in? how are you going to overcome the clear lens narrow angle of a led? you could make it opaque by roughing it up with wet and dry paper to make it more diffused or what would be way way better is get some non clear hot glue (the white wood sticks not clear glue ones) and with that stuff you could actually make a kind of candle flame spiky shape which would diffuse the colour nice.
how are they going to be powered? for how long you running them at a time? (you need to know all this stuff before code!!) think about it, you cant code before you know for example if you need a battery to run it, and for how long, this might be an issue and at code time you may have to take into account battery usage and do clever stuff in code like get micro to sleep to save every last drip of juice from the battery!

flesh the project out for us in detail and then we talk code ;)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top