реклама:

Control buttons. Part 14.

Control buttons

UPDATE: Buttons are disabled in current firmware. Use encoder!

Last optional item is a keyboard connection. As I said before, all the manipulation and adjustment of the controller can be carried out via the encoder, so there is no need to connect the keyboard. This item is intended more for those who do not have encoder for arduino, but have four buttons.

Wiring diagram looks like this:

Arduino clock buttonts

Keyboard for Arduino

Arduino keyboard

I used part of breadboard to assemble a simple keyboard.

Once connected, you can download here an example to check their performance. After pressing on the screen will appear the name - LEFT, RIGHT, UP and DOWN, respectively, that means left, right, top and bottom.

Sample:

// include the library code:
#include <LiquidCrystal.h>

#define UP_PIN 22
#define DN_PIN 25
#define RT_PIN 24  
#define LT_PIN 23

#define PWM_LED_PIN 3 
#define PIN_LCD_RS 39
#define PIN_LCD_EN 41
#define PIN_LCD_D4 43
#define PIN_LCD_D5 45
#define PIN_LCD_D6 47
#define PIN_LCD_D7 49
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd( PIN_LCD_RS, PIN_LCD_EN, PIN_LCD_D4, PIN_LCD_D5, PIN_LCD_D6, PIN_LCD_D7 );

void setup() {   
  analogWrite( PWM_LED_PIN, 255 );
  lcd.begin(16, 2); 
  lcd.print("House4u sol.proj");
}

int i = 0;
void loop() 
{     
   lcd.setCursor(0, 1); 
   lcd.print("Key: ");
   
   if ( digitalRead(UP_PIN) == HIGH )
     lcd.print("UP");
   else
   if ( digitalRead(DN_PIN) == HIGH )
     lcd.print("DOWN");   
   else
   if ( digitalRead(LT_PIN) == HIGH )
     lcd.print("LEFT");   
   else   
   if ( digitalRead(RT_PIN) == HIGH )
     lcd.print("RIGHT");   
   else   
     lcd.print("          ");
     
   delay( 10 );  
}

The result of program:

The result of program

It seems that's all !!! We hooked up and checked all the components necessary for the proper functioning of our hot water controller. I, like the "pioneer", have spent many weeks to collect all the information together, develop programming of arduino, waiting for the components by the mail, etc ... I hope with all the data in one place and clear instructions you will be able to make controller for solar collectors much faster!


<< BackNext >>


Share with friends:

Donate