Interactive light
Idea and Concept:
1. A light activated by human activities.
2. interactivity. interactive toy/product ....furniture
3. Run by itself (Pic)
Material: plastic
Location: Door way / Room
Activity:
When it stands alone , no light and movement
It activates when something gets close.
More movement and lighting when play with it.
========
IR Sensor (analog)--> PIC(analog) ----> LED & Step Motor(analog)
Code:
DEFINE OSC 4
DEFINE ADC_BITS 10
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEUS 50ADCvar VAR WORD
ADCvar2 VAR WORD
ADCvar3 VAR WORD
ADCvar4 VAR WORD' set variables:
steps VAR WORD
stepArray VAR BYTE(4)
ClearTRISA = %11111111
ADCON1 = %10000010TRISD = %11110000
PORTD = 255OUTPUT PORTC.3
OUTPUT PORTC.4
OUTPUT portb.6
OUTPUT portb.7
OUTPUT portb.5stepArray[0] = %00001010
stepArray[1] = %00000110
stepArray[2] =%00000101
stepArray[3] = %00001001PAUSE 500
main:
ADCIN 0, ADCvar ' Read channel 0 to adval
ADCIN 1, ADCvar2
ADCIN 2, ADCvar3
ADCIN 3, ADCvar4if (ADCvar <40) AND (ADCvar2 < 40)AND (ADCvar3 < 40) AND (ADCvar4 <
40) thenLOW portc.3
LOW portc.4
LOW portb.6
LOW portb.7
LOW portb.5
ENDIFif (ADCvar > 40) OR ( ADCvar2 > 40)OR(ADCvar3 >40)OR(ADCvar4 >40) then
High portb.5
high portc.3
low portc.4
High portb.6
LOW portb.7
steps = steps + 1
portD = stepArray[steps //4]pause 4
ENDIFif (ADCvar > 180) OR (ADCvar2 >180) OR(ADCvar3 >180)OR(ADCvar4 >180)
thenHigh portb.5
HIGH portc.3
High portc.4
High portb.6
high portb.7
steps = steps + 1
portD = stepArray[steps //4]
ENDIFSerout2 PORTC.6, 16468, [DEC ADCvar, 13, 10] ' print it to serial out,
' with linefeed and carriage return (10, 13)
goto main