查看“1장. LED 켜기(브레드보드를 이용하기)”的源代码
←
1장. LED 켜기(브레드보드를 이용하기)
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{Language|1장--LED 켜기(브레드보드를 이용하기)}} {| style="width: 800px;" |- | ==목표== 마이크로두이노를 이용하여 LED를 제어하는 방법을 배우게 될 것입니다.. 마이크로아두이노의 I/O 포트를 어떻게 제어하는지 배울 것이고 I/O 포트를 제어하는 것은 매우 기초적인 기술이며 앞으로도 많이 사용하게 될 것입니다. ==재료== *'''[[Microduino-Core/ko|마이크로아두이노 코어 모듈]]''' 마이크로아두이노 코어모듈은 '''[http://www.atmel.com 아트멜사]'''의 ATmega328P, ATmega168PA 시리즈를 기반으로 만들어진 8비트 마이크로프로세서 개발보드입니다. 자세한 사항은 '''[http://wiki.microduino.net/index.php?title=Microduino-Core 마이크로두이노 코어모듈]'''을 참조하세요 *'''[[Microduino-USBTTL(FT232RL)]]''' 마이크로두이노 코어 또는 코어 플러스 모듈과 PC를 연결하여 프로그램을 다운로드할때 사용하는 모듈입니다. 마이크로 USB 사양을 채택하고 있습니다. 1달러 동전과 비슷한 사이즈를 가지고 있습니다. 스마트폰의 USB 케이블과 같으므로 편리하고 실용적입니다. 자세한 사항은 '''[http://wiki.microduino.net/index.php?title=Microduino-FT232R Microduino-FT232R]'''를 참조하세요. *기타 재료들 **브레드보드 점퍼선 약간 **브레드보드 1개 **LED 1개 **220ohm 저항 1개 **USB 데이터 케이블 1개 ===브레드보드 알아보기=== In the vertical direction,5 points connected together and 25 points connected together in a horizontal direction. Some bread has 50 points connected together, so make sure connection format before you use it, in order to avoid generating erroneous results. The next two rows of points 50 have more usage, one row as GDN, the other row as VCC. Please refer to the following picture. [[File:breadboard.jpg|600px|center|thumb]] ===저항과 LED=== Limiting resistor is used to prevent LED burned. Usually red and green LED voltage is 1.8 ~ 2.4V, blue and white is 2.8 ~ 4.2V, 3mmLED rated current is 1 ~ 10mA, 5mmLED rated current is 5 ~ 25mA, and 10mmLED rated current is 25 ~ 100mA. According to R = U / I to the calculated resistance. Usually hundreds of ohm should be ok. ==회로도== There are two connection methods, one is that led cathode connects to GND, anode connects to Microduino digital I/O port 13, which is the high light led. The other method ist that led cathode connected Microduino digital I/O port 13, anode connects to VCC, so that low-level light led. [[File:schematic.jpg|600px|center|thumb]] ==프로그램== *Using delay() function: <source lang="cpp"> int led = 13;// Define the PIN void setup() { pinMode(led, OUTPUT); // Define the I/O port 13 as output } void loop() { digitalWrite(led, HIGH); //I/O port 13 output High. If the connection is high lighted,the LED will light, otherwise extinguished delay(1000); // delay 1s digitalWrite(led, LOW); //I/O port 13 output Low.If the connection is high lighted,the LED off, otherwise light. delay(1000); // delay 1s } </source> *Using function milles():Return the number of milliseconds from start running Microduino program to now. <source lang="cpp"> int ledPin=13; #define TIME 1000 long time1=0,time2=0; void setup() { pinMode(ledPin,OUTPUT); } void loop() { if(millis()<time2+TIME) { digitalWrite(ledPin,HIGH); time1=millis(); } else { digitalWrite(ledPin,LOW); if(millis()>time1+TIME) time2=millis(); } } </source> Using function millis () is better than the delay () function, less resource and fewer delays on the system. ==프로그램 다운로드 방법== *Choose the board type in "tools", the "Microduino-Core(ATmega328P@16M,5V)" is used in this experiment. There are two types of 328 board, so you need identify which type board you are using. You can check the 0 resistor's connection method to identify. [[File:boardtype.jpg|600px|center|thumb]] *Choose COM port.Matched serial port is different for everyone's computer, so you just need choose your own. The COM port is in "properties"->"device manager" in your computer, you also can double-click "Advanced" to change the COM port by port settings. *Compile downloads [[File:compile.jpg|600px|center|thumb]] [[File:download.jpg|600px|center|thumb]] ==결과== After the download, you can see LED flashes once every 1s. ==비디오== |}
该页面使用的模板:
模板:Language
(
查看源代码
)
模板:Nmbox
(
查看源代码
)
返回至
1장. LED 켜기(브레드보드를 이용하기)
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
Welcome
首页
创客大赛
大赛详情
3D打印
安装月球车
图形化编程
操控月球车
升级月球车
编程工具下载
软件下载
Arduino
Processing
Mixly
Scratch
模块套件
Microduino 102
mCookie 102
mCookie 202
mCookie 302
IBC
其他
应用套件
四轴飞行器
平衡车
小车CUBE
音乐播放器
刷卡音乐播放器
wifi气象站
彩虹音乐触摸灯
分贝检测仪
迎门汇报
LED点阵时钟
LED点阵屏幕
硬件
mCookie
Sensor
Microduino
MicroWrt
MicroNux
MicroRobot-Core
MicroRobot-CoreESP
ideaBoard
ideaBox
MicroMV
MicroAI
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息