Skip to content

Instantly share code, notes, and snippets.

@eduardodx
Created January 27, 2012 19:37
Show Gist options
  • Save eduardodx/1690524 to your computer and use it in GitHub Desktop.
Save eduardodx/1690524 to your computer and use it in GitHub Desktop.
Test
void setup() {
Wire.begin( 2 );
Wire.onRequest( requestEvent );
Wire.onReceive( receiveEvent );
}
void requestEvent(){
// Envia requisicoes dos botoes
for (int i = 0; i < 4; i++){
Wire.write( botoesEstado[i] );
}
}
void receiveEvent( int howMany ) {
// Recebe andar
andar = Wire.read();
// Recebe estado das portas
for( int i = 0; i < 4; i++ ) {
portasEstado[i] = Wire.read();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment