Hi everyone,
I'm a beginner in the kind of programming, and I have an assignment from my school to do simple project!
I chose an experiment that already existed in this website, so I can get started quickly.
Here's the brushes (Reflective IR sensor) link from Adafruit that I bought: https://www.adafruit.com/products/2349
And I have this Feather, also from Adafruit: https://www.adafruit.com/products/2821
I want to apply the IR sensor for the LED( same the experiment in the IR sensor webpage); however, I couldn't find an appropriate Software code for that!
ANY help will be appreciated!
need an Arduino code from a tutorial that posted in adafruit
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mohammedkw
- Posts: 4
- Joined: Thu Sep 15, 2016 3:57 pm
- adafruit_support_jarek
- Posts: 324
- Joined: Tue Nov 08, 2016 11:48 am
Re: need an Arduino code from a tutorial that posted in adaf
Hi there! As long as you wire up the sensor the exact same way as in the picture under Technical Details https://www.adafruit.com/products/2349 , you should be able to read the sensor by using the function
In order for the sensor to work, you have to first turn on the LED:
A quick sample sketch to see if everything works:
Code: Select all
digitalRead( 9 );
Code: Select all
digitalWrite( 13, HIGH );
Code: Select all
#define LED_PIN 13
#define SENSOR_PIN 9
void setup() {
Serial.begin( 9600 );
pinMode( LED_PIN, OUTPUT );
pinMode( SENSOR_PIN, INPUT_PULLUP );
digitalWrite( LED_PIN, HIGH );
}
void loop() {
byte state = digitalRead( SENSOR_PIN );
Serial.println( state );
}
Please be positive and constructive with your questions and comments.