evenjc

I2C Request - Slave

Mar 6th, 2019
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wire.h>
  2.  
  3. int this_i2c_slaves_adress = 8;
  4.  
  5. void setup() {
  6.   // put your setup code here, to run once:
  7.   Wire.begin(this_i2c_slaves_adress);
  8.   Wire.onRequest(request);
  9. }
  10.  
  11. void loop() {
  12.   // put your main code here, to run repeatedly:
  13.   delay(100);
  14. }
  15.  
  16. void request () {
  17.   Wire.write("Hey, I am an Arduino!");
  18. }
Advertisement
Add Comment
Please, Sign In to add comment