New to this malarkey so please excuse the ingorance.
I built the "Start Here" robot by fritsl. Works fine no problems - great introduction. Moved on to a BEAM mini sumo from Junkbots and got someone at work to explaine why it worked...
So, I have tried to expand and experiment with the pic based bot. I have added LEDs and light sensitive direction. Works OK
My problem is with the IR detection using a PNA4602 and irin.
I replaced the sharp GP2D12 with the PNA4602. From the left with the bubble facing;
Pin1=output (middle pin)
Pin2=black (pin furthest from the edge of the board) and
Pin3=red (pin closest to the edge of the board)
I started using readadc 0, b1 - that was what is in the code for the sharp. This sort of worked, with b1 changing from 255 to 3 as I pressed lots of remotes, always 3. I then read about irin and thats where I got bogged down. No matter what flavor of irin I used the program just hung on the irin line. It refused to either timeout of accept that an IR signal had been received. Going back to readadc, proved that the IR receiver was still working.
eg code
main:
irin [500 , main], 0, b1 or irin 0, b1
etc
Im using PICAXE-28X1 (40X1) Firmware version 6
Have I plugged the PNA4602 into the correct place, looks ok because readadc at least reads in a value ?
Whats wrong with irin, it will not timeout or read anything in?
When the IRIN command times out it will go to the TIMEOUT sub which will then return you to the line following your IRIN command in the MAIN subroutine.
I thought I was the only one who said “malarky.” Then again, I thought I was one of the last to habitually use the words “epic” and “awesome” till I came here too.
The Picaxe 28x board (the one used for the start here robot) has provisions on it for the addition of a IR sensor. There are places on the board to solder your 3-pin IR sensor and the cap/ resistors needed to make it go. Picaxe also has/uses IR commands built-in so it is able to talk nice to any Sony brand remote as well as anything that can transmit a 38khz signal with sony protocal.
Well I have learnt a bit more so thanks for the feedback.
No I was not using the necessary resistors or capacitor and I was connecting the IR detector to the wrong place on the board, apart from that not too bad - good start.
The best lead was from another forum topic that pointed me at a Picaxe IR kit, which went on to a parts list and a real diagram showing where to stick the bits - not a mumbo jumbo circuit diagram (http://www.rapidonline.com/netalogue/specs/13-0840.pdf) .
So I need 2 resistors and a capacitor - about a £1, not the £10 Picaxe want.
My code is still a question, irin does not timeout, perhaps when I have the parts in the correct place it may work better.
I’m currently trying to make my 28x board be able to recieve IR from a TV remote as well, but not having much luck. I think my problem may be in my code, though, as I have the reciever soldered directly into IR-area on the board (along with the necessary components)…
Right now, it looks something like this:
ircontrol: IRIN [500, ircontrol],0,infra if infra = 1 then gosub tiltup if infra = 2 then gosub tiltdown if infra = 3 then gosub panright if infra = 4 then gosub panleft if infra = 5 then gosub clawclose if infra = 6 then gosub clawopen
I think I may be trying to use the wrong input pin, but let me know. Thanks.
Sorry I forgot to put this question in my last post.
The only other thing that I could think of that might be the problem is that I might have the microcontroller looking for the infra red signal on the wrong input pin. i.e: IRIN [500,ircontrol] 0, b13
I think you didn’t understand my previous reply. In short, you can’t timeout back to the same sub you’re already in. It seems to be how everyone tries to set it up the first time. Try this:
ircontrol:
irin [500, timeout], 0, b13
insert your check for IR code here
timeout:
return
You code looks like it needs some ENDIF statements IIRC. Only IF…GOTO can be used without the ENDIF at the end.
edit- Incorrect; omission of ENDIF does not cause a syntax error, my bad.