SHARE
TWEET

Untitled

a guest Dec 2nd, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wire.h>
  2. byte buffercito[9] = {0x55,0x6e,0x61,0x50,0x72,0x75,0x65,0x62,0x61};
  3. int sinValue = 0;
  4.  
  5. void setup() {
  6.   Wire.begin(2); //Dirección de cada placa
  7.   //Wire.onReceive(receiveEvent); // Llama al método (esclavo) cuando se reciben datos
  8.   Serial.begin(9600);
  9.   Serial.println("Started");
  10.   //TWAR = (1 << 1) | 1; // Activa recepción broadcast, el primer número indica la dirección
  11.   Wire.onRequest(handler);
  12.   Serial.println("Registered");
  13. }
  14.  
  15. void handler(int whatecs){
  16.   for (int i = 3; i >= 0; i--){
  17.     Wire.write((sinValue >> 8 * i) & 0xFF);
  18.   }
  19.        
  20.     Serial.println(sinValue);
  21.   }
  22.  
  23. void loop() {
  24.   sinValue = (int)(1024 * sin(millis()));
  25.  
  26.  
  27.  
  28.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top