Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- const int sensorPin = 7;
- int sensorValue = 0;
- void setup () {
- Wire.begin(4);
- Wire.onRequest(requestEvent);
- }
- void loop() {
- delay(500);
- sensorValue = analogRead(sensorPin);
- }
- void requestEvent() {
- uint8_t data[1];
- data[0] = (uint8_t)sensorValue;
- Wire.write(data, 2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement