radiogareth
Senior Member
I've wanted to us some IR remote control for a while and finally got round to it.
Using the standard Rudolf IR TX board I measure the standby current - on 3 cells it's about 0.15uA - not bad for sitting in a loop checking.
So that project can go ahead just fine - I have updated the code to use 4 buttons and the built-in pullups. No need to see it TX so I deleted the visible LED, mainly as input C5 does not have an internal pullup and can't be used as an output. Yes I could add a resistor and keep both, but how many IR remotes have a visual indication anyway.
I then looked at my moneybox code - using the piezo trigger. This code uses 1.5 mAmps, so not really suitable for battery power. Why the difference and what is causing it?
Thoughts and sugestions very welcome!
Gareth
Using the standard Rudolf IR TX board I measure the standby current - on 3 cells it's about 0.15uA - not bad for sitting in a loop checking.
Code:
' ***** main loop *****
' Based on Rudolf example with added pullups
'loop until switch is pressed
pullup on
main:
if pin1 = 1 then tx_1
if pin2 = 1 then tx_2
if pin3 = 1 then tx_3
if pin4 = 1 then tx_4
goto main
tx_1:
let b1 = 1 ' Code 1
goto tx_ir
tx_2:
let b1 = 2 ' Code 2
goto tx_ir
tx_3:
let b1 = 3 ' Code 3
goto tx_ir
tx_4:
let b1 = 4 'Code 4
goto tx_ir
'transmit code 10 times for increased reliability
tx_ir:
for b2 = 1 to 10 ' send infrared code 10 times
infraout 0,b1 ' send code
pause 45 ' wait 45 milliseconds
next b2
goto main
I then looked at my moneybox code - using the piezo trigger. This code uses 1.5 mAmps, so not really suitable for battery power. Why the difference and what is causing it?
Code:
'simple tap on, off software, using a piezo element on an input.
'Wired with a 5 volt zener across it to clip the signal to -0.7 and +5.0
'You can add a whole sequence of button presses each stage doing something
' else like light patterns. The limit
'is your patience in tapping to get back to all off!
lightoff:
If pin3 = 1 then waitup 'if the button is pressed on pin 3 'the software jumps to the lighton procedure
goto lightoff ' loops around and does it again......
lighton:
If pin3 = 1 then goto waitdown
goto lighton
waitup:
high 0,1,2 'turns on whatever is connected to the high power output
pause 1000'waits for 1 second before it does anything else
'this gives you time to take your finger off the button/taps to stop!
goto lighton
Waitdown:
low 0,1,2 'needed here to turn the light OFF having returned from on.
pause 1000'waits for 1 second before it does anything else
'this gives you time to take your finger off the button!
goto lightoff
Gareth
Last edited: