Home 2018 Forums Crumble Support Using connections for input AND output?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2212
    Mike
    Participant

    Hi,

    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

    #2213
    Simon
    Moderator

    Try it and let us know if it works 🙂

    #2214
    Joseph
    Keymaster

    In theory it should work as the I/O is configured on the fly. Have not tested it yet though.

    Joseph

    #2240
    Mike
    Participant

    Have been trying to run an HC-SR04 off a single I/O but it’s not happy… :/

    #2249
    Joseph
    Keymaster

    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.

    Joseph

    #2250
    Mike
    Participant

    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. 🙂

    #2253
    Joseph
    Keymaster

    I’m planning to add a block for this too 🙂 I’m hoping to get more accurate timing working first though…

    Joseph

    #2330
    Peter
    Participant

    Hello
    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 – Imagineering

    #2331
    Mike
    Participant

    Peter, 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! 🙂

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.