added status LED to I2C Arduino slave
This commit is contained in:
parent
a3571ceb42
commit
fcada51f0f
1 changed files with 6 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue