Advertisement
Guest User

Untitled

a guest
Apr 18th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <Wire.h>
  2. char* time;
  3.  
  4. void setup() {
  5. Wire.begin(9); //start as slave on address 9
  6. Wire.onReceive(receiveEvent); //attach a function to trigger when something is received
  7. Serial.begin(9600);
  8. }
  9.  
  10. void receiveEvent(int bytes) {
  11. time = Wire.read(); //read one character from the I2C
  12.  
  13. }
  14.  
  15. void loop() {
  16. Serial.println(time);
  17. delay(1000);
  18. }
  19.  
  20. //slave
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement