Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- byte buffercito[9] = {0x55,0x6e,0x61,0x50,0x72,0x75,0x65,0x62,0x61};
- int sinValue = 0;
- void setup() {
- Wire.begin(2); //Dirección de cada placa
- //Wire.onReceive(receiveEvent); // Llama al método (esclavo) cuando se reciben datos
- Serial.begin(9600);
- Serial.println("Started");
- //TWAR = (1 << 1) | 1; // Activa recepción broadcast, el primer número indica la dirección
- Wire.onRequest(handler);
- Serial.println("Registered");
- }
- void handler(int whatecs){
- for (int i = 3; i >= 0; i--){
- Wire.write((sinValue >> 8 * i) & 0xFF);
- }
- Serial.println(sinValue);
- }
- void loop() {
- sinValue = (int)(1024 * sin(millis()));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement