MUstar

IoT 아두이노 0616 - V/R + ("*")MOVE

Jun 15th, 2017
59
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <LiquidCrystal.h>
  2. int pin_VR = A1;
  3. int pin_LCD_DATA[8] = {A8,A9,A10,A11,A12,A13,A14,A15};
  4. int pin_LCD_CTRL[3] = {A5,A6,A7};
  5. LiquidCrystal lcd(A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15);
  6.  
  7.  
  8. void setup() {
  9.   pinMode(pin_VR, INPUT);
  10.   lcd.begin(16,2);
  11.  
  12. }
  13.  
  14. void loop() {
  15.   lcd.clear();
  16.   uint16_t da = analogRead(pin_VR);
  17.   int go_move = da / 50;
  18.   lcd.setCursor(0, 1);
  19.   lcd.print("ADC Data :");
  20.   lcd.setCursor(11, 1);
  21.   if(da<1000){lcd.print(" ");}
  22.   if(da<100){lcd.print(" ");}
  23.   if(da<10){lcd.print(" ");}
  24.   lcd.print(da);
  25.   lcd.setCursor(go_move, 0);
  26.   lcd.print("*");
  27.   delay(500);
  28. }
RAW Paste Data