added some libs and projects
This commit is contained in:
parent
e258739fc6
commit
c175b7c85c
39 changed files with 2546 additions and 0 deletions
22
I2C_SLAVE_PHOTORESISTOR/I2C_SLAVE_PHOTORESISTOR.ino
Normal file
22
I2C_SLAVE_PHOTORESISTOR/I2C_SLAVE_PHOTORESISTOR.ino
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
#include <Wire.h>
|
||||
|
||||
int lightPin = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Wire.begin(7); // join i2c bus with address #7
|
||||
Wire.onRequest(requestEvent); // register event
|
||||
Serial.begin(9600); //Begin serial communcation
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
Serial.println(analogRead(lightPin));
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
void requestEvent()
|
||||
{
|
||||
Wire.write(analogRead(lightPin)); // respond with message of 6 bytes
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue