Skip to content

Loading…

Direct Pin controll #87

Closed
cooltrooper opened this Issue · 4 comments

2 participants

@cooltrooper

Add a pin object for direct controll of a pin rather than i being wrapped in a device specific class.

ps i dont know how useful the attached code is but I thought i may help.

https://gist.github.com/4054614

@rwaldron
Owner

We could do something similar, but I'd rather make a generic Pin class that initializes "pin control instances"

@cooltrooper

That sounds useful, would it be a good idea if it had access methods as well as emitting events?

@rwaldron
Owner

So far...

// will guess that this is digital and assume you mean "input" mode until you write something to it, 
// which it will then automatically switch to "output" mode.
var dig = new five.Pin(13);

// Or manually... (it won't be hex like that)
dig.mode( 0x01 );

// set it high...
dig.high();

// set it low...
dig.low();

// ... which also emits a "high" and "low" event...

// will guess that this is analog... same as above.
var ana = new five.Pin("A0");

I'll keep on working on this later tonight.

@cooltrooper

That looks good, much simpler than I was making it

@rwaldron rwaldron added a commit that closed this issue
@rwaldron Direct Pin control: new five.Pin(#). Closes gh-87
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
0358d43
@rwaldron rwaldron closed this in 0358d43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.