1 / 10

Good LED Circuit

Good LED Circuit. 5V0. GND. What Voltage Does Meter See?. Answer: 5 V. What Voltage Does Meter See?. Answer: 0 V. R is a pull-down resistor. What Voltage Does Meter See?. Answer: 0 V. What Voltage Does Meter See?. Answer: 5 V. R is a pull-up resistor.

shiloh
Download Presentation

Good LED Circuit

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Good LED Circuit 5V0 GND

  2. What Voltage Does Meter See? Answer: 5 V

  3. What Voltage Does Meter See? Answer: 0 V R is a pull-down resistor

  4. What Voltage Does Meter See? Answer: 0 V

  5. What Voltage Does Meter See? Answer: 5 V R is a pull-up resistor

  6. chipKit Sense Switch& Control LED

  7. chipKit Sense Switch& Control LED

  8. Program to Turn on LED /* Set Pin 25 (ledPin) to HIGH. */ intledPin = 25;// Label Pin 25 ledPin. void setup() { // setup() runs once. pinMode(ledPin, OUTPUT); // Set ledPin for output. } void loop() {// loop() runs "forever". digitalWrite(ledPin, HIGH);// Set ledPin HIGH. }

  9. Button-Controlled LED /* Set Pin 25 (ledPin) to HIGH if Pin 4 (buttonPin) is HIGH. Otherwise set Pin 25 to LOW. */ intledPin = 25; // Label Pin 25 ledPin. intbuttonPin = 4; // Label Pin 4 buttonPin. void setup() { // setup() runs once. pinMode(buttonPin, INPUT); // Set buttonPin for input. pinMode(ledPin, OUTPUT); // Set ledPin for output. } void loop() { // loop() runs "forever". // Check if buttonPin is HIGH. if (digitalRead(buttonPin) == HIGH) { digitalWrite(ledPin, HIGH); // Set ledPin HIGH. } else { digitalWrite(ledPin, LOW); // Set ledPin LOW. } }

  10. Button-Controlled (Blinking) LED /* Alternate Pin 25 (ledPin) between HIGH and LOW every half second if Pin 4 (buttonPin) is HIGH. Otherwise set Pin 25 to LOW. */ intledPin = 25; // Label Pin 25 ledPin. intbuttonPin = 4; // Label Pin 4 buttonPin. void setup() { // setup() runs once. pinMode(buttonPin, INPUT); // Set buttonPin for input. pinMode(ledPin, OUTPUT); // Set ledPin for output. } void loop() { // loop() runs "forever". // Check if buttonPin is HIGH. if (digitalRead(buttonPin) == HIGH) { digitalWrite(ledPin, HIGH); delay(500); // Wait a half second. digitalWrite(ledPin, LOW); delay(500); // Wait another half second. } else { digitalWrite(ledPin, LOW); } }

More Related