Stupid pic
trick

Finally it has been completed and it is stupin but it doees communicate. I got so fed up with midi that I decided that I would use the few things that I have laying around the house and yesturday I was at the grocery store and for no reason just grabed one of those plastic vegetable bags and had an epiphony that I had to use it so..... here it is

Basically the fan goes on, blows up the bag, which bends the flex sensor, which turns on the buzzzer. There is a nice delay which happens after the buzzer starts till when it stops because the bag of air takes a while to deflate. This could be usefull in future projects.

Here is the code which is basically the same code that I used on both of the PICs. It doesn't particularly show any great pic prowess but I did learn come doing it and now I feel quite comfortable playing with my PIC..



include "modedefs.bas"
 DEFINE OSC 4
 DEFINE ONINT_USED 1

 ' Set Debug pin port
 DEFINE DEBUG_REG PORTC
 ' Set Debug pin BIT (RC4 in this case)
 DEFINE DEBUG_BIT 6
 ' Set Debug baud rate
 DEFINE DEBUG_BAUD 9600
 ' Set Debug mode: 0 = true, 1 = inverted
 DEFINE DEBUG_MODE 1
 ' Set number of bits in result
 DEFINE  ADC_BITS        10 
 ' Set clock source (3=rc)
 DEFINE  ADC_CLOCK       3   
 ' Set sampling time in microseconds
 DEFINE  ADC_SAMPLEUS    10     

 myVar VAR BYTE ' Create variable to store result

 ' Set PORTA to all input
 TRISA = %11111111     
 trisc.3 = 0
 ' Set up ADCON1
 ADCON1 = %10000010      

 Pause 500               ' Wait .5 second

               
 ' set up constant value for linefeed (ASCII value 10)
 lf CON 10
 ' set up constant value for carriage return (ASCII value 13)
 cr CON 13
 trisb.0 = 1
 
 main:
   ADCIN 0, adcVar ' Read channel 0
 ' do something with adVar here
   debug "pot=", DEC adcVar,lf,cr
   'myVar = portb.0
 'debug "myvar=", DEC myVar,lf,cr
 
' if my pot, or flex sesor is greater then 600 turn C.3 high
if adcVar < 600 then
    portc.3 = 1
    else
    portc.3 = 0
    endif
   Pause 10 
 GoTo main 

 

As always I am behind and do not have a final project or a concept or a partner and it seems as if people who I would be interested in working with have all been snapped up. I know that I want to do something with music and I have been thinking a lot about radio waves and all the things that are in the air around us, maybe I could do something with that. I am also supposed to review the first response that I wrote so I will do that, if I can find it.

 

 

sculpting home

Journal Entries: 1.......2.......3.......4stupid pic........5midterm paper........RADIO RUNNER (final project).