May 15, 2015 at 12:16 am #2212
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 thanksMay 15, 2015 at 6:22 am #2213SimonModerator
Try it and let us know if it works 🙂May 15, 2015 at 8:16 am #2214
In theory it should work as the I/O is configured on the fly. Have not tested it yet though.
JosephMay 16, 2015 at 4:37 pm #2240
Have been trying to run an HC-SR04 off a single I/O but it’s not happy… :/May 16, 2015 at 9:54 pm #2249
I’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.
JosephMay 16, 2015 at 10:28 pm #2250
That 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 #2253
I’m planning to add a block for this too 🙂 I’m hoping to get more accurate timing working first though…
JosephJune 9, 2015 at 9:03 am #2330PeterParticipant
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?
Peter L – ImagineeringJune 9, 2015 at 9:20 am #2331
- You must be logged in to reply to this topic.