“Lesson 12--Microduino "Light indicator"”的版本间的差异

来自Microduino Wikipedia
跳转至: 导航搜索
(photo added)
 
(未显示同一用户的1个中间版本)
第18行: 第18行:
 
**10k resistor               one  
 
**10k resistor               one  
 
**USB Data cable              one
 
**USB Data cable              one
 +
 +
[[File:lesson11All.jpg|600px|center|thumb]]
  
 
==Experimental schematic==
 
==Experimental schematic==
第68行: 第70行:
 
When the light is very weak, lower the seted minimum value, all the lights are off. With the increase of light, reach to a set level would light up an LED, to achieve the effect of instruction. Actually LED lamp has been flashing, because in order to make the light intensity is not a certain level, to put out the light of the level, directly after the lights out immediately, with no delay in the implementation process, as long as the grade, circulation processing, so it looks as if always on.
 
When the light is very weak, lower the seted minimum value, all the lights are off. With the increase of light, reach to a set level would light up an LED, to achieve the effect of instruction. Actually LED lamp has been flashing, because in order to make the light intensity is not a certain level, to put out the light of the level, directly after the lights out immediately, with no delay in the implementation process, as long as the grade, circulation processing, so it looks as if always on.
  
 +
[[File:lesson11Result.jpg|600px|center|thumb]]
  
 
==Video==
 
==Video==
  
 
https://www.youtube.com/watch?v=U3aOOc4cxtI
 
https://www.youtube.com/watch?v=U3aOOc4cxtI

2015年7月3日 (五) 07:09的最新版本

Language English

Objective

In photoresistance experiment, The light is divided into two levels, strong or weak. This experiment will finish a light indictor using 4 LEDs and divides the light into 5 levels. Photoresistance receives the more light, and light up more LED to achieve the purpose of instruction.

Equipment

  • Microduino-Core
  • Microduino-FT232R
  • Other hardware equipment
    • Breadboard Jumper one box
    • Breadboard one piece
    • Photoresistance one
    • LED Light-emitting diodes four
    • 220Ω four
    • 10k resistor one
    • USB Data cable one
Lesson11All.jpg

Experimental schematic

The photoresistance's connection in contrast to the last time, the purpose is let you know the usage of photoresistance deeply. photoresistance directly connects to the power supply at one end, the other end through a resistance to connect GND . The initial state is low, with the increase of light intensity voltage is higher and higher.

Program

void setup ()
{
    Serial.begin(115200);
  for(int i=2; i<=5;i++)          //Set the I/O port 2 - 5 to output mode.
  {
  pinMode(i,OUTPUT);
  }
}
void loop ()
{
 
  int n =analogRead(A0);  //Read the value of photoresistance
   //Serial.println(n);
   
  if (n>=100)             //Judge the color hierarchy. You can djust the level values  according to your own used environment, minimum is 0, and maximun is 1023.
  {
    digitalWrite(2,HIGH);
    digitalWrite(2,LOW);  //When no longer this level, the lights will go off
  }
  if(n>250)
   {
    digitalWrite(3,HIGH);
    digitalWrite(3,LOW);
  }
    if(n>400)
   {
     digitalWrite(4,HIGH);
     digitalWrite(4,LOW);
  }
    if(n>550)
   {
     digitalWrite(5,HIGH);
     digitalWrite(5,LOW);
  }
  //  delay(100);
}

Result

When the light is very weak, lower the seted minimum value, all the lights are off. With the increase of light, reach to a set level would light up an LED, to achieve the effect of instruction. Actually LED lamp has been flashing, because in order to make the light intensity is not a certain level, to put out the light of the level, directly after the lights out immediately, with no delay in the implementation process, as long as the grade, circulation processing, so it looks as if always on.

Lesson11Result.jpg

Video

https://www.youtube.com/watch?v=U3aOOc4cxtI