- This topic has 8 replies, 4 voices, and was last updated 8 years, 5 months ago by
Mike.
-
AuthorPosts
-
May 15, 2015 at 12:16 am #2212
Mike
ParticipantHi,
Is it possible to use A or B etc as an output, setting it high or low, and then a bit further on in the same program, treat it as an input and read a high or analog value from the same ‘pin’? Or is is ‘locked’ into one of the two roles as soon as you treat it as input or output? Maybe this is set at compile time?
Many thanks
May 15, 2015 at 6:22 am #2213Simon
ModeratorTry it and let us know if it works 🙂
May 15, 2015 at 8:16 am #2214Joseph
KeymasterIn theory it should work as the I/O is configured on the fly. Have not tested it yet though.
Joseph
May 16, 2015 at 4:37 pm #2240Mike
ParticipantHave been trying to run an HC-SR04 off a single I/O but it’s not happy… :/
May 16, 2015 at 9:54 pm #2249Joseph
KeymasterI’ve just checked and the I/O starts as an input and is set to an output as soon as a ‘set’ block is used, however, reading the input doesn’t change it back – sorry! I’m currently rewriting the VM (in the PIC), so I will change this.
Joseph
May 16, 2015 at 10:28 pm #2250Mike
ParticipantThat would be brilliant! Hopefully then we could run this super-cheap sensor with just one I/O. It’s a bit more complex to code than the simple sharp ir sensor, but it works ok with 2 I/O. And only £2 instead of £7. 🙂
May 17, 2015 at 1:24 am #2253Joseph
KeymasterI’m planning to add a block for this too 🙂 I’m hoping to get more accurate timing working first though…
Joseph
June 9, 2015 at 9:03 am #2330Peter
ParticipantHello
It will be most useful to have the ability to reverse I/O direction. I am working on a traffic light model project with a group of KS2 children. Using 3 LED’s and a Buzzer consumes the 4 output lines.Incorporation of a switch for input – (Like a pelican crossing cross request) only works once as Crumble needs power down to restore input sensing.
Hopefully I/O direction control code will be incorporated in software update revisions soon?
Or is there another way?
Thanks
Peter L – ImagineeringJune 9, 2015 at 9:20 am #2331Mike
ParticipantPeter, obvious solution is to use sparkles as they can all chain off D and the control for them is built in?
Or hack a motor output to make it run the buzzer! 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.