Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- char* time;
- void setup() {
- Wire.begin(9); //start as slave on address 9
- Wire.onReceive(receiveEvent); //attach a function to trigger when something is received
- Serial.begin(9600);
- }
- void receiveEvent(int bytes) {
- time = Wire.read(); //read one character from the I2C
- }
- void loop() {
- Serial.println(time);
- delay(1000);
- }
- //slave
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement