first of all is it imperitive that you have a 100k resistor in the ldr circuit for it to work?(<please answer) if this is not needed then
why does this code only beep the same pitch every time it checks even though the light changes,
Ive got this on a breadboard and its weird because ive put a speaker in and it doesnt work on pin 4 which i have wired it to and coded it to but when i wire it to the 3rd pin from the top left with the semicircle on the left it works!
main:
output 4
input 1
input 2
wait 1
goto sensor1
goto sensor2
end
sensor1: readadc 1,b1
if b1<50 then snd1 b1 = 200
if b1<100 then snd2 b1 = 200
if b1<145 then snd3 b1 = 200
if b1<175 then snd4 b1 = 200
end
sensor2: readadc 2,b2
if b2<50 then snd1 b2 = 200
if b2<100 then snd2 b2 = 200
if b2<145 then snd3 b2 = 200
if b2<175 then snd4 b2 = 200
end
snd1:
sound 4,(100,50)
wait 1
goto sensor1
goto sensor2
end
snd2:
wait 1
sound 4,(80,50)
goto sensor1
goto sensor2
end
snd3:
wait 1
sound 4,(60,50)
goto sensor1
goto sensor2
end
snd4:
wait 1
sound 4,(40,50)
goto sensor1
goto sensor2
end
why does this code only beep the same pitch every time it checks even though the light changes,
Ive got this on a breadboard and its weird because ive put a speaker in and it doesnt work on pin 4 which i have wired it to and coded it to but when i wire it to the 3rd pin from the top left with the semicircle on the left it works!
main:
output 4
input 1
input 2
wait 1
goto sensor1
goto sensor2
end
sensor1: readadc 1,b1
if b1<50 then snd1 b1 = 200
if b1<100 then snd2 b1 = 200
if b1<145 then snd3 b1 = 200
if b1<175 then snd4 b1 = 200
end
sensor2: readadc 2,b2
if b2<50 then snd1 b2 = 200
if b2<100 then snd2 b2 = 200
if b2<145 then snd3 b2 = 200
if b2<175 then snd4 b2 = 200
end
snd1:
sound 4,(100,50)
wait 1
goto sensor1
goto sensor2
end
snd2:
wait 1
sound 4,(80,50)
goto sensor1
goto sensor2
end
snd3:
wait 1
sound 4,(60,50)
goto sensor1
goto sensor2
end
snd4:
wait 1
sound 4,(40,50)
goto sensor1
goto sensor2
end