Created
January 27, 2012 19:37
-
-
Save eduardodx/1690524 to your computer and use it in GitHub Desktop.
Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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