Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 19, 2024, 12:33:01 00:33


Login with username, password and session length


Pages: [1]
Print
Author Topic: Help with picaxe08M  (Read 3817 times)
0 Members and 1 Guest are viewing this topic.
Korvo
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 1
-Receive: 1


« on: November 11, 2011, 11:18:41 11:18 »

Hi, i'm new to programming Pic, Avr and picaxe, so i begin with picaxe to learn more.
After some experiences with picaxe08m I intend to make the folow program:
2 push buttons and 2 leds
press push button 1 -> on led1 3 seconds -> if press push button 1 during the 3 seconds -> led 1 off
                                                                     -> if no press button -> off led1 after the 3 seconds
the same for push button 2 and led 2

one condition: Never on led 1 and led 2 at the same time

I used the setinterrupt function, but not work properly, maybe i don't understand this function properly.
My code is:

let dirs = %00000110
main:
    If pin4 = 1 then  led1
    If pin3 = 1 then led2
  goto main

led1:
     setint %10010000,%10010000
     high 2
     pause 3000
     low 2
   goto main

interrupt:
     if pin4 = 1  or pin3 = 1 then
     low 2
     low 1
   end if
setint %10000000,%10000000
  goto main

led2:
    setint %10001000,%10001000
    high 1
    pause 3000
    low 1
   goto main   

Any Sugestion?
Thanks
Logged
luiz_a2software
Inactive

Offline Offline

Posts: 4

Thank You
-Given: 3
-Receive: 1


« Reply #1 on: November 12, 2011, 10:09:15 10:09 »

try while

i = 0
while i < 3000
   pause 1
   i = i + 1
wend

Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC