Board is a representation of a Make Controller connected to mchelper. You'll never need to create your own Board objects, as mchelper is the source of this information, and it will create and notify you when a new board is connected, or a board is disconnected.
A Board has a few relevant properties. The type tells you whether it's USB or Ethernet, and the location is a unique value - an IP address for Ethernet boards, and a device location for USB boards. You can always count on these two values being in place for a baord, while the name and serialnumber values will only be available once mchelper has had a chance to probe the connected boards.
If you're only working with one Make Controller Kit, it can be useful to use the setDefaultBoard on McFlashConnect. This way, once you set the board's information once, you can simply use the send() method, instead of sendToBoard() which requires that you specify each time which board you want to send to. The most convenient time to do this is when mchelper tells you a new board is connected - simply pass this new board into setDefaultBoard().
Example
function onBoardArrived( event:McEvent ) { var newBoard:Board == event.data; mcFlash.setDefaultBoard( newBoard ); }There are also a few helper methods to find connected boards:
- getBoardByIPAddress( )
- getBoardByUsbLocation( )
- getBoardsByName( )
- getBoardsBySerialNumber( )