HomePage RecentChanges JohhnyFive Events

Johnny Five Events

Most of the objects emit events. A pin can be used like this:

#!JavaScript
        var out1 = new five.Pin(4);
        out1.on('high', function() {
                console.log('We got a high', this.addr);
        });

Yes this is an output but you still get the events fired. Sometimes...

#!JavaScript
  out1.low(); out1.high();    // Triggers event
  out1.write(0); out1.write(1); // FAILS to trigger event
  board.digitalWrite(4, 0); board.digitalWrite(4, 1); // FAILS to trigger event

This means you have to be clever programmatically for calling the high/low method from a value, e.g. out1[ value ? 'high' : 'low'](); So be very careful.

Software error:

Can't locate object method "endform" via package "CGI" at /data/scott.dd.com.au/wiki/modules/search.pl line 15.

For help, please send mail to the webmaster (webmaster@dd.com.au), giving this error message and the time and date of the error.