​ ​ ​ ​ Walking robot with 08M2
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: Walking robot with 08M2

  1. #1
    Member
    Join Date
    Jun 2011
    Location
    Czech Republic
    Posts
    31

    Default Walking robot with 08M2

    Hello everybody,
    I am kindly asking for help. I built a walking robot - inspiration from here: http://www.lollybotrobotics.co.uk/resources.html
    I would like the robot to beep while turning. I cannot achieve this. I tried multitasking with start0 and start1 where start1 handled the beeping but it did not work. Maybe the 08M2 is too busy handling the servos. I was only able to make sound before it starts turning and I learned at Let's make robots that is better to add command low after sound command to let the corresponding pin be at log 0. Can anybody advice? Thank you for help. Code is attached:
    Code:
    rem c.1  servo
    rem c.4  servo
    rem c.2  HC-SR04 trigger
    rem c.3  HC-SR04 echo
    rem c.0  piezzo
    
    #no_data
    
    symbol time1 = 100
    
    
    servo c.1,150
    servo c.4,150
    pause 500
    
    
    main:
    
    pause 10
    pulsout c.2,5
    pulsin c.3,1,w1
    pause 10
    
    w1 = w1*10/58
    ;sertxd ("w1 = ",#w1," Cm ",cr,lf)
    pause 50
    if w1<15 then
    
    	gosub turn
       else
    	gosub walk_forward
    endif
    goto main
    
    #rem
    servos_mid_position:
    servo c.1,150
    servo c.4,150
    pause 20
    return
    #endrem
    
    walk_forward:
    servo c.1,120
    pause time1
    servo c.4,120
    pause time1
    servo c.1,180
    pause time1
    servo c.4,180
    pause time1
    return
    
    turn:
    sound c.0,(120,50,0,50,120,50,0,50,120,50,0,50) low c.0
    for b1 = 1 to 5
    servo c.4,120
    pause time1
    servo c.1,90
    pause time1
    servo c.4,180
    pause time1
    servo c.1,150
    pause time1
    next b1
    return
    walker.jpg

  2. #2
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,463

    Default

    SOUND is a blocking command so everything stops while the sound is played, even when SOUND is put in a separate task.

    The best way to do SOUND in parallel to something else is to use a second PICAXE to generate the sound which can be triggered from the pin which would have been used to output the sound.

    If SEROUT is used ( and SERIN or HSERIN on the sound generating PICAXE ) you can have it generate different sounds, but it's probably best to start with just triggering a single sound with HIGH and LOW signals.

  3. #3
    Member
    Join Date
    Jun 2011
    Location
    Czech Republic
    Posts
    31

    Default

    I thought so, but was not sure. Thank you very much for your help.

  4. #4
    Senior Member
    Join Date
    Jul 2011
    Location
    Los Angeles, CA
    Posts
    1,905

    Default

    I'm a huge fan of these tiny 10-cent buzzers and rarely build a circuit without one: http://www.ebay.com/itm/232045296534 The types used in fire alarms.

    No SOUND command required, they emit a LOUD fixed beep tone just from a 5V signal, pulling ~20mA. For best results, connect buzzer's +pin to +5V, other pin to Picaxe pin, drive low to activate. Works fine with servo and pwm commands, even at 4.5V (3xAA) https://www.youtube.com/watch?v=IrRRgLXzl3U

    They come with a wash sticker in place, which reduces volume considerably. Handy, tape works too.

    You can also send various SOUNDs through them if you like:

    https://www.youtube.com/watch?v=WBJq6RZhOvw
    https://www.youtube.com/watch?v=EF1-noeMqVI
    https://www.youtube.com/watch?v=NMX5kicEoJw
    https://www.youtube.com/watch?v=ggah9mkvx-U

  5. #5
    Member
    Join Date
    Jun 2011
    Location
    Czech Republic
    Posts
    31

    Default

    Thank you for the hint.

  6. #6
    Senior Member
    Join Date
    Jul 2011
    Location
    Los Angeles, CA
    Posts
    1,905

    Default

    HTH.

    NemluvÝm česky, I biked through Czech and ran the Praha marathon in 2001. What a great country!

  7. #7
    Senior Member
    Join Date
    Sep 2016
    Location
    United Kingdom
    Posts
    694

    Default

    Quote Originally Posted by erco View Post
    HTH.

    NemluvÝm česky, I biked through Czech and ran the Praha marathon in 2001. What a great country!
    And their Budvar is the proper stuff

  8. #8
    Senior Member
    Join Date
    Jul 2011
    Location
    Los Angeles, CA
    Posts
    1,905

    Default

    Quote Originally Posted by stan74 View Post
    And their Budvar is the proper stuff
    +1, Budweiser is a very poor substitute. Not even close.

    I lived in Japan with a team for several months. Our Japanese host Bandai often splurged and hosted fancy dinners with (ugh) Budweiser, an expensive imported beer from the US. We tried a few times to tell them how much we preferred Asahi & Sapporo but they politely insisted that we deserved the finest (Budweiser), so we just had to roll with it.

  9. #9
    Senior Member
    Join Date
    May 2010
    Location
    Newcastle Australia
    Posts
    309

    Default

    You could use a SPE035 or similar to give you bot multiple sounds.

    This is a sample of some of the sound on my bot

    https://www.youtube.com/watch?v=BNP2ViHBlGo

    Bill
    "It always seems imposible until it's done" Nelson Mandela.

  10. #10
    Senior Member
    Join Date
    Sep 2016
    Location
    United Kingdom
    Posts
    694

    Default

    YES Bill! I bought the rev ed one so no messin about and plan 2...give robot attitude. Download audacity and play with samples

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •