User Tools

Site Tools


Sidebar

Dan's Wiki

DokuWiki Instructions (local) DokuWiki Manual
Site Checker (Orphans Wanted)

Edit Sidebar

projects:a4sim:photointerrupter

This is an old revision of the document!


Photo Interrupter

 
#define PI_LED 4
 
int detectorVal = 0;
 
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(PI_LED, OUTPUT);
  digitalWrite(PI_LED, HIGH);
}
 
void loop() {
  // put your main code here, to run repeatedly:
 
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(500);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(500);                       // wait for a second
  detectorVal = analogRead(A0);
  Serial.println(detectorVal);
 
}
projects/a4sim/photointerrupter.1566350476.txt.gz · Last modified: 2019/08/21 01:21 by dwheele