¸ÞÄ«¼Ö·ç¼Ç PCF8591 ¾ÆµÎÀÌ³ë ¶óÀ̺귯¸®
4°³ÀÇ ADC¿Í 1°³ÀÇ DAC¸¦ ³»ÀåÇÑ PCF8591Á¦Ç°ÀÇ ¶óÀ̺귯¸® ¸ðµâÀÔ´Ï´Ù.
- Àͼ÷ÇÑ ¾ÆµÎÀ̳ëÀÇ AnalogRead ÇÔ¼ö³ª AnalogWrite ÇÔ¼öÀÇ ÇüÅ·Π±â´ÉÀÌ Á¦°øµË´Ï´Ù.
- ´ë½Å DAC¸ðµå ºñÈ°¼ºÈ°¡ µÇÁö ¾ÊÀ¸´Ï ÀÌ·¯ÇÑ ±â´ÉÀÌ ÇÊ¿äÇÏ´Ù¸é º» ¶óÀ̺귯¸®¸¦ ¼öÁ¤Çؼ Àç¹èÆ÷ ºÎŹµå¸³´Ï´Ù.
- ¶óÀ̺귯¸®¿¡ ¹º Àǹ̰¡ ÀÖ°Ú½À´Ï±î? ¸¶À½²¯ ¾²¼¼¿ä
±âº»ÀûÀÎ »ç¿ë¹ýÀ» ¼Ò°³ ÇÏ°íÀÚ ÇÕ´Ï´Ù.
¼Ò½ºÄÚµå
Çʼö Çì´õ
±âº»ÀûÀ¸·Î IIC Åë½ÅÀ» À§ÇØ ¾ÆµÎÀ̳ëÀÇ Wire ¶óÀ̺귯¸®¸¦ ÇÔ²² »ç¿ëÇÕ´Ï´Ù.
#include <Wire.h>
#include <MECHA_PCF8591.h>
MECHA_PCF8591 pcf;//°´Ã¼ ¸íÀº ÀÚÀ¯·ÎÀÌ »ç¿ë °¡´ÉÇÕ´Ï´Ù.
void setup(){
Wire.begin();//IIC Åë½Å »ç¿ëÀ» À§ÇØ Wire ¼³Á¤À» ÇØÁÖ¾î¾ß ÇÕ´Ï´Ù.
}
IIC Address ¼³Á¤Çϱâ
±âº» IIC Address¸¦ »ç¿ëÇÏ°í ÀÖ´Ù¸é ÇÊ¿ä¾øÁö¸¸ IICÁÖ¼Ò¸¦ º¯°æÇؼ »ç¿ëÁßÀ̶ó¸é ´ÙÀ½°ú °°ÀÌ »ç¿ëÀÌ °¡´ÉÇÕ´Ï´Ù.
pcf.setAddress(0x49);
analogRead()
PCF8591¿¡´Â 4°³ÀÇ ¾Æ³¯·Î±× ÇÉÀÌ ÀÖ½À´Ï´Ù. (0¹ø ~ 3¹ø)
int AnalogData = pcf.analogRead(0);
Serial.println(AnalogData);
analogWrite()
¾Æ½±°Ôµµ PCF8591¿¡´Â DACÇÉÀÌ Çϳª ¹Û¿¡ ¾ø½À´Ï´Ù. ÇɹøÈ£¸¦ Á¤ÇØÁÙ ÇÊ¿ä´Â ¾ø°ÚÁö¿ä?
pcf.analogWrite(243);
¸¶¹«¸®
Á»´õ ´Ù¾çÇÑ Á¤º¸´Â ¸ÞÄ«¼Ö·ç¼Ç °ú ¿ÀÇ·¦ ¿¡¼ ¾Ë¾Æº¸½Ç ¼ö ÀÖ½À´Ï´Ù.