added status LED to I2C Arduino slave

This commit is contained in:
Johannes Findeisen 2015-08-26 02:41:39 +02:00
commit fcada51f0f

View file

@ -6,6 +6,7 @@ int lightPin = 0;
void setup()
{
pinMode(13, OUTPUT);
Wire.begin(7); // join i2c bus with address #7
Wire.onRequest(requestEvent); // register event
Serial.begin(9600); //Begin serial communcation
@ -13,11 +14,14 @@ void setup()
void loop()
{
Serial.println(analogRead(lightPin));
delay(1000);
//Serial.println(analogRead(lightPin));
//delay(60000);
}
void requestEvent()
{
Wire.write(analogRead(lightPin)); // respond with message of 6 bytes
digitalWrite(13, HIGH);
delay(50);
digitalWrite(13, LOW);
}