Input Devices

This week I tried to get an understanding of the differences in between digital and analog sensors.I based myself on the last Helloworld's circuit and added: Photodarlington sensor that would display "There is light"when there is presence of light and would display "It is dark" when there is absence of light.

I then programmed the board with simple arduino code which will display "It is dark" once the photodarlington sensor is covered or in darkness and "There is light" when the sensor is exposed to light to visualize the results on the serial displayer.

After that I printed in Roland Mill with the help of Classmates that normally use it: Schematic Board Trace Outline Done Cutting and soldering the Board Indication of the photodarlington polarity Showing how to identify positive on a photodarlington sensor

#include < SoftwareSerial.h>

SoftwareSerial mySerial = SoftwareSerial (0,2);

int sensorPin = 2;         
int sensorValue = 0;  

void setup() {
  mySerial.begin(9600);
  mySerial.println("Photodarlington");
}

void loop() {
  sensorValue = analogRead(sensorPin);
  mySerial.println(sensorValue);
  delay(500);

  if (sensorValue > 1000){
    mySerial.println("It is Dark!");
  }
  else {
    mySerial.println("There is light!");
  }
}