Photosensor

  1. int photocellPin = 0; // the cell and 10K pulldown are connected to a0
  2. int photocellReading; // analog reading from the sensor divider
  3. int LEDpin = 11; // connect to the Red LED to pin 11 
  4. int LEDbrightness;
  5. void setup(void) {
  6. // will send debugging information in the  Serial monitor
  7. Serial.begin(9600);
  8. }
  9. void loop(void) {
  10. photocellReading = analogRead(photocellPin);
  11. Serial.print(“Analog reading = “);
  12. Serial.println(photocellReading); // the  analog reading
  13. // LED gets brighter the darker it is at the sensor
  14. photocellReading = 1023 photocellReading;
  15. LEDbrightness = map(photocellReading, 0, 1023, 0, 255);
  16. analogWrite(LEDpin, LEDbrightness);
  17. delay(100);
  18. }

myblink

// the setup function will play once when you press reset or power the board

void setup() {
// uses the LED number 13
pinMode(13, OUTPUT);
}

// the code will run in a loop, again and again
void loop() {
digitalWrite(13, HIGH);   // turns on the LED
delay(0500);              // wait for half a second
digitalWrite(13, LOW);    // turn off the LED
delay(1000);              // wait for a second
}

Electrical vs. Electronic

Electrical – Electrical uses electricity as power, this mostly converts the power to a different type of energy. For example air conditioner and fan and tvs.

Electronic – Electronic alters the nature of the electric currents itself, which allows it to do productive tasks. Uses active electrical components such as vacuum tubes, diodes and circuits. These days, these devices usually have some form of computer or micro-controller in it. Additionally, the currents are used to transmit information. For example computer, new fridges, and cell phones.

The most important difference between electrical and electronic devices is that electronic devices are more advanced than electrical devices. Both electrical and electronic devices take in electricity and alter it into some form of energy, electronic devices can alter currents to send information and do tasks electrical devices couldn’t.

Disadvantages of electronic:

  • If one part of the hardware/software is not working then the rest of the system will not compute at all.
  • Electronic devices are costly

Advantages of electronic:

  • Instead of someone being actively there to manually send a command (input) electronic can be timed however you would want it. Also there are less flaws.
  • The system works together like a parallel circuit.
  • It is easier to alter the unit because it all connects back to the micro controller.
  • Electronic are less of wiring and save times.
  • Also this is more advanced

Summary: NYC made the a justified decision in switching to electronic traffic lights because it allowed for the most efficient way to organize and increase the safety of the civilians.  First of all, you wont need a being there to handle the traffic lights every single second, but time to time to check on the system. Another great point for picking electronic is that it’s works as a parallel circuit because for NYC if one traffic light goes down then it will be ok but for all of them it will make chaos.