intervall timer siren


Closed Thread
Results 1 to 2 of 2
  1. #1
    oeloeg's Avatar
    oeloeg Guest

    Default intervall timer siren

    I need intervall siren... with recordable time off and on...(at startup push button for time on, release wait and push again to record time off)
    I 've done it this way for now but I want also to change the sound
    Now I have to change the times each time...
    Is it more easy with timer? don't know how...



    program BIEP

    dim count as byte
    dim counter as byte
    dim time1 as byte
    dim time2 as byte

    main: 'start main program
    TRISD = %01100000
    Sound_Init(PORTC, 3)

    record:
    if (Button(PORTD,1,1,1)) then 'record time
    time1 = 0
    time2 = 0

    while (Button(PORTD,1,1,1)) 'record on time
    time1 = time1 + 1 'time1 + 1 (250ms)
    delay_ms(250) '+1 = 250ms
    wend 'end loop

    while (Button(PORTD,1,0,0)) 'record off time
    time2 = time2 + 1 'time2 + 1 (250ms)
    delay_ms(250) '+1 = 250ms
    wend 'end loop

    else
    goto loop
    end if

    loop: 'begin loop program

    if (Button(PORTD,2,0,0)) then
    for count = (time1/2) to 0 step -1
    Sound_Play(730, 250) 'siren
    Sound_Play(1152, 250)
    next count
    else


    for count = (time1*3) to 0 step -1
    Sound_Play(730, 25) 'siren 2
    Sound_Play(935, 25)
    Sound_Play(1152, 25)
    next count

    end if 'einde knop D.2 detectie

    for counter = time2 to 1 step -1
    delay_ms(250) 'pauze = time2 * 250ms
    next counter

    goto loop
    end.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: intervall timer siren

    The folks at this forum will be able to help you, I think.
    http://www.protonbasic.co.uk/
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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