LCD.zip



#include <Wire.h>

#include "rgb_lcd.h"


rgb_lcd lcd;


const int colorR = 255;

const int colorG = 0;

const int colorB = 0;


void clear1()

{

    lcd.setCursor(1, 0);

    lcd.print("                ");

}

void clear2()

{

    lcd.setCursor(1, 1);

    lcd.print("                ");

}

void setup() 

{

    lcd.begin(16, 2);

    lcd.setRGB(0, 0, 0);

    pinMode(A0,INPUT);

    lcd.print("hello, world!");

    delay(1000);

}


void loop() 

{

    int adRead=0;

    adRead=analogRead(A0);

    adRead=adRead/4;

    if(adRead >= 250) adRead=250;

    delay(100);

    clear2();

    lcd.setCursor(0, 1);

    lcd.print(adRead);

    lcd.setRGB(adRead, (255-adRead), adRead);

    delay(100);

}





'Study > Arduino' 카테고리의 다른 글

FND Number Count  (0) 2014.09.15
4-Digit Display header file  (0) 2014.09.15
SW체터링 소프트웨어적 해결  (0) 2014.09.05
Arduino LED Control  (0) 2014.09.02
Arduino PWM Control  (0) 2014.08.30
Posted by 차희빈

차희빈

달력