Let's Make Robots!

Light Control Robot - and now finally finished with Movie 1

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sciguy77's picture
Thanks a lot! I love seeing the code that makes it work.
sciguy77's picture
The light following (part 2) code, only if its not too much trouble though. :)
ArunioSmo's picture

symbol pause1 = 50
symbol pause2 = 20

as:
let pins = %00000000
readadc10 1,w1
debug w1
if w1 > 900 then goto start
goto as

start:
readadc10 1,w1
readadc10 4,w4
if w1 >= w4 then goto forward1
if w4 > w1 then goto backward1

forward1:
readadc10 1,w1
readadc10 2,w2
readadc10 3,w3
readadc10 4,w4
let w5 = w4 - 100
    if w5 > w1 then goto backward1
    if w1 > 1200 then goto stopp
    if w1 > w2 and w1> w3 then goto forward2
    if w2 > w3 then goto leftforward
    if w3 > w2 then goto rightforward
goto forward1

leftforward:
let pins = %00000100
pause pause1
goto forward1

rightforward:
let pins = %00010000
pause pause1
goto forward1

forward2:
let pins = %00010100
pause pause1
goto forward1

backward1:
readadc10 1,w1
readadc10 2,w2
readadc10 3,w3
readadc10 4,w4
let w7 = w1 - 100
    if w7 > w4 then goto forward1
    if w4 > 1200 then goto as
    if w4 > w2 and w4 > w3 then goto backward2
    if w2 > w3 then goto leftbackward
    if w3 > w2 then goto rightbackward
goto backward1

leftbackward:
let pins = %00001000
pause pause1
goto backward1

rightbackward:
let pins = %00100000
pause pause1
goto backward1

backward2:
let pins = %00101000
pause pause1
goto backward1

stopp:
let pins = %00000000
readadc10 4,w4
    if w4 > 900 then goto as
goto stopp


OddBot's picture

It looks almost capable of flight :D

sciguy77's picture
Hey, can I see the code for light following? Thanks. :)
ArunioSmo's picture

which part?

Part one -fire fighting or / and

Part two -light follower or / and

Part three - light follower with PWM and fire fighting


 

LOLGeek's picture
I like the wind candle fighting. :)
TheOther1's picture
That is pretty cool.  I was going to try a hovercraft, but I like the blower + driven wheels.