Inputs & pullups

Interfacing to the codebug
Post Reply
mikerr
Posts: 83
Joined: Fri Jul 31, 2015 10:37 am
Contact:

Inputs & pullups

Post by mikerr » Wed Oct 14, 2015 4:55 pm

Anyone played with inputs other than the touch/ground examples ?

I see there is a "start cog" block for disabling the pullup resistors:

Image

but that doesn't do what I want
- I'm trying to sense a 3v "high" on the leg, looks like I may need a transistor?

also what do these blocks do ?

Image

Doesn't seem similar to "leg 0 grounded" as "get leg 0 " always returns 1 even when not grounded ?!
Twitter @mikered codebug profile mikerr

BMS Doug
Posts: 61
Joined: Wed Aug 26, 2015 8:54 am
Contact:

Re: Inputs & pullups

Post by BMS Doug » Thu Oct 15, 2015 7:50 am

mikerr wrote:Anyone played with inputs other than the touch/ground examples ?

I see there is a "start cog" block for disabling the pullup resistors:

Image

but that doesn't do what I want
- I'm trying to sense a 3v "high" on the leg, looks like I may need a transistor?

also what do these blocks do ?

Image

Doesn't seem similar to "leg 0 grounded" as "get leg 0 " always returns 1 even when not grounded ?!
If we disable the pull-up could we then use an external pull-down and invert the return signal?

I asked that question [url=http://www.codebug.org.uk/learn/activit ... -kit/}here[/url] in the "Whats next" section.
I'd like to connect a peripheral which will pull it's output high (5V) when it's condition is satisfied, all of the instructions I have found so far indicate how to operate a switch that connects to ground rather than one that pulls high.
Should I add a physical pulldown resistor (as there isn't a pulldown option in blockly)?
Will I need to add a voltage divider to the output to drop the voltage level onto the input leg?
Thomas MacPherson-Pope recommends using a Transistor:
CodeBug has pullup resistors so the inputs default to high. To achieve what you need you could use a transistor to pull the pin to CodeBug's ground when your peripheral

mikerr
Posts: 83
Joined: Fri Jul 31, 2015 10:37 am
Contact:

Re: Inputs & pullups

Post by mikerr » Thu Oct 15, 2015 8:56 am

Tom just replied on twitter:
Tom Macpherson-Pope ‏@T_Mac_P

@mikered set leg will output high or low . get leg will return 1 unless grounded (as the legs are pulled up).
Twitter @mikered codebug profile mikerr

pigraham
Posts: 65
Joined: Sat Aug 15, 2015 1:41 pm

Re: Inputs & pullups

Post by pigraham » Thu Oct 15, 2015 9:12 am

I would expect that disabling the pullup and adding an external pull down should work. Get Leg should return 1 when 5V is on the leg and 0 otherwise. Try it and see.

mikerr
Posts: 83
Joined: Fri Jul 31, 2015 10:37 am
Contact:

Re: Inputs & pullups

Post by mikerr » Thu Oct 15, 2015 2:04 pm

Yes, got that working now - I did need the pulldown resistor from input leg to GND

Used it to get v. simple comms between two codebugs:
http://codebugforum.co.uk/viewtopic.php?f=11&t=53
Twitter @mikered codebug profile mikerr

Post Reply