Author Topic: [WIP] QTC Mood Light  (Read 942 times)

Offline frenulem - No.5417

  • Ultimate Badass
  • Blogs & Media Team
  • Acid Modder
  • *
  • Posts: 633
  • Post quality +23/-0
  • Gender: Male
  • Learning Pascal Cuz i'm dumb and 'Ting
[WIP] QTC Mood Light
« on: January 15, 2011, 09:46:40 AM »
This is a topic about my second GCSE project, Just the Ideas and such because most of you know more than my teacher and can correct me.

So what I'm trying to make is a Mood Light Controlled a piece of QTC controlling a RGB LED.

The Process diagram.....block.....thingy

Input        >      Process    >      Output
Pressure on the QTC   PICAXE-08    Different colours

The QTC just acts as a Variable Resistor, so I am going to use the ADC input. I found this program


main:                                                             ; make a label called ‚main
readadc C.1,b0                                                ; read ADC1 into variable b0
if b0 > 120 then top                                         ; if b0 > 120 then do top
if b0 < 70 then bot                                           ; if b0 < 70 then do bot
low B.0                                                          ; else switch off 0
low B.4                                                          ; and switch off 4
goto main                                                       ; jump back to the start

top:                                                               ; make a label
high B.0                                                          ; switch on 0
low B.4                                                           ; switch off 4
goto main                                                        ; jump back to start

bot:                                                               ; make a label
high B.4                                                          ; switch on 4
low B.0                                                           ; switch off 0
goto main                                                        ; jump back to start


so i just have to edit that program and this is my first foray into the world of programs so...

this is what i came up with
main:                                                             ; make a label called main
readadc 1 , b0                                                    ; read ADC1 into variable b0
if b0 > 255 then red                                              ; if b0 > 120 then do top
if b0 > 170 then green                                            ; if b0 < 70 then do bot
if b0 > 85 then blue
low B0                                                            ; else switch off 0
low B1
low B2                                                            ; and switch off 4
goto main                                                         ; jump back to the start

red:                                                              ; make a label
high B0
wait 2                                                           ; switch on 0
low B1                                                            ; switch off 4
goto main                                                         ; jump back to start

green:                                                            ; make a label
high B1
wait 2                                                           ; switch on 4
low B0
low B2                                                            ; switch off 0
goto main                                                         ; jump back to start

blue:
high B2
wait 2
low B0
low B1
goto main


Just realised that this makes it flash, added a "wait" tag
« Last Edit: February 04, 2011, 01:32:46 AM by frenulem »

 

SMF spam blocked by CleanTalk
SimplePortal 2.3.5 © 2008-2012, SimplePortal