Site Language

Translate

Russian Albanian Arabic Armenian Azerbaijani Belarusian Bulgarian Catalan Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician Georgian German Greek Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Serbian Slovak Slovenian Spanish Swedish Turkish Ukrainian Yiddish

CashBack Реальный возврат при покупках в интернете

Основные версии плат Arduino

Due — плата на базе 32-битного ARM микропроцессора Cortex-M3 ARM SAM3U4E;

Leonardo — плата на микроконтроллере ATmega32U4;

Uno — самая популярная версия базовой платформы Arduino;

Duemilanove — плата на микроконтроллере ATmega168 или ATmega328;

Diecimila — версия базовой платформы Arduino USB;

Nano — компактная платформа, используемая как макет. Nano подключается к компьютеру при помощи кабеля USB Mini-B;

Mega ADK — версия платы Mega 2560 с поддержкой интерфейса USB-host для связи с телефонами на Android и другими устройствами с интерфейсом USB;

Mega2560 — плата на базе микроконтроллера ATmega2560 с использованием чипа ATMega8U2 для последовательного соединения по USB-порту;

Mega — версия серии Mega на базе микроконтроллера ATmega1280;

Arduino BT — платформа с модулем Bluetooth для беспроводной связи и программирования;

LilyPad — платформа, разработанная для переноски, может зашиваться в ткань;

Fio — платформа разработана для беспроводных применений. Fio содержит разъем для радио XBee, разъем для батареи LiPo и встроенную схему подзарядки;

Mini — самая маленькая платформа Arduino;

Pro — платформа, разработанная для опытных пользователей, может являться частью большего проекта;

Pro Mini — как и платформа Pro, разработана для опытных пользователей, которым требуется низкая цена, меньшие размеры и дополнительная функциональность.

 

CashBack Все честно и без обмана

 

Это информационный ресурс с лучшими инструкциями и туториалами по использованию контроллеров Arduino

 Карта сайта Arduino, Mega ADK, Cubieboard Cubietech, Arduino Uno, Arduino Mega2560, Карта сайта, Arduino Fio, Cubietruck, Arduino Ethernet, Esplora, Arduino Robot, Raspberry, Arduino Leonardo, Arduino Due, Arduino Micro, Banana, Intel Galileo Gen 2, Arduino Duemilanove, Beaglebone, BananaPro, Arduino Usb, Intel, Intel Galileo, Intel, Intel Galileo, Intel Edison, Intel Edison, Intel Galileo Gen 2, Карта сайта, Arduino Duemilanove, Mega ADK, Arduino Duemilanove, Arduino Nano, Arduino Leonardo, Arduino Due, Arduino Micro, Arduino Lilypad, Arduino Uno, Arduino Uno, Arduino Mega2560, Cubietruck, Raspberry, Banana, Arduino Leonardo, Arduino Due, Lilypad Arduino Simple, Lilypad, Arduino Usb, Arduino Micro, Lilypad, Arduino Simple Snap, Lilypad Arduino Simple, Intel, Lilypad, Arduino Cubieboard, Arduino Usb, BananaPro, Arduino Gemma, Arduino EthernetArduino Yin, Arduino Zero, Mega ADK, Arduino 101 Genuino 101, Arduino mini, Lilypad Arduino Simple, Lilypad, Arduino Pro, Intel, Arduino Fio, Arduino Gemma, Arduino BT, Arduino Fio, Arduino Mega, Arduino NanoMega ADK, Arduino Uno, Arduino Diecimila, BananaPro, Intel, Intel Galileo, Arduino Ethernet, Arduino BT, Arduino Mega, Arduino Duemilanove, Arduino Nano, Esplora, Raspberry, Banana, Arduino Robot

Модуль LCD монитора LCD1602 (Z- LCD I2C Keypad Shield)

Модуль LCD монитора LCD1602 Модуль LCD монитора LCD1602
Модуль LCD монитора LCD1602

 

Технические характеристики:

• Дисплей: Символьный 16х02

• Подсветка: Синяя с белыми символами

• Подсветка (режим работы ВКЛ/ВЫКЛ): Управляется выводом P3 микросхемы PCF8574T

• Подсветка (режим регулирования яркости): Управляется ШИМ выводом Arduino на выбор (3, 5, 6, 9, 10 либо 11).

• Контраст: Настраивается потенциометром

• Кнопки: 6 шт (5 считываемых и перезагрузки)

• Напряжение питания: 5 В

• Интерфейс: I2C

• I2C адрес: 0x2

 

Sketch code

 

/*Проверка работы LCD 1602
  Проверка работы кнопок
  Select, Left, Up, Down, Rigth, Rst
  Изменение яркости экрана
  http://progdron.com/ru/22-shild/298-lcd1602
 

 */

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

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

void setup() {
  analogWrite(10, 100);// изменение яркости экрана
  lcd.begin(16, 2);
  lcd.clear();
 
 
}
byte key(){//1-719, 2 - 477, 3 - 131, 4 -305, 5 - 0
  int val = analogRead(0);
  if (val < 50) return 5;
  else if (val < 150) return 3;
  else if (val < 350) return 4;
  else if (val < 500) return 2;
  else if (val < 800) return 1;
  else if (val <= 1023) return 0;
}
void loop() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("analogRead:");
  lcd.print(analogRead(0));
  lcd.setCursor(0,1);
  switch (key())
  {
   case 1:
    lcd.print("Select");
     break;
   case 2:
    lcd.print("Left");
  break;
  case 3:
    lcd.print("UP");
    break;
    case 4:
     lcd.print("Down");
    break;
    case 5:
     lcd.print("Rigth");
     break;
   
  }
 
  delay(350);
 
}

 

 

Sketch code

//This program is made to be used with the LCD keypad shield from HobbyKing.com
//It is highly likely that other shields could be substituted.
//Some of the code is copied example code available on the public domain.
//-------------------------------------------------------------------------------
//by Matthew, March 3, 2013
//http://projectsfromtech.blogspot.com/
//
//Current functionality:
//The user selects add, subtract, multiply, or divide
//The user inputs the first value
//The user inputs the second value
//Answer is calculated and printed to screen
//
//Work for the future:
//Select number by digit (ie. 1000 = 1-0-0-0. Current model would involve 1000 button pushes)
//Add push and hold functionality
//Add other functions: sine, cosine, power, etc.
//Find bug that makes functions not print to screen 3rd time through.


#include <Wire.h>

#include <LiquidCrystal.h>   // include LCD library

/*--------------------------------------------------------------------------------------
 Defines
 --------------------------------------------------------------------------------------*/
// Pins in use
#define BUTTON_ADC_PIN           A0  // A0 is the button ADC input

#define LCD_BACKLIGHT_PIN         10  // D10 controls LCD backlight

#define RIGHT_10BIT_ADC           0  // right
#define UP_10BIT_ADC            120  // up
#define DOWN_10BIT_ADC          280  // down
#define LEFT_10BIT_ADC          480  // left
#define SELECT_10BIT_ADC        720  // right
#define BUTTONHYSTERESIS         30  // hysteresis for valid button sensing window
//return values for ReadButtons()
#define BUTTON_NONE               0  //
#define BUTTON_RIGHT              1  //
#define BUTTON_UP                 2  //
#define BUTTON_DOWN               3  //
#define BUTTON_LEFT               4  //
#define BUTTON_SELECT             5  //
//some example macros with friendly labels for LCD backlight/pin control, tested and can be swapped into the example code as you like
#define LCD_BACKLIGHT_OFF()     digitalWrite( LCD_BACKLIGHT_PIN, LOW )
#define LCD_BACKLIGHT_ON()      digitalWrite( LCD_BACKLIGHT_PIN, HIGH )
#define LCD_BACKLIGHT(state)    { if( state ){digitalWrite( LCD_BACKLIGHT_PIN, HIGH );}else{digitalWrite( LCD_BACKLIGHT_PIN, LOW );} }
/*--------------------------------------------------------------------------------------
 Variables
 --------------------------------------------------------------------------------------*/
byte buttonJustPressed  = false;         //this will be true after a ReadButtons() call if triggered
byte buttonJustReleased = false;         //this will be true after a ReadButtons() call if triggered
byte buttonWas          = BUTTON_NONE;   //used by ReadButtons() for detection of button events


int SelectingMenu = true;               //This will be true until the select button is pressed in Menu()
int scroll = 0;                         //Used in Menu(). Stores numerical value of key pressed
int button = 0;                         //Sets scroll when a button is pressed. Acts on it when release
int menu = 4;                           //Stores the value of the menu. Used in Menu()
int FunctionChoice;                     //Stores the value of the selected function
float Answer;                           //where the answer is stored.

float A;                                //holds the values being computed
float B;
/*--------------------------------------------------------------------------------------
 Init the LCD library with the LCD pins to be used
 --------------------------------------------------------------------------------------*/
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );   //Pins for the freetronics 16x2 LCD shield. LCD: ( RS, E, LCD-D4, LCD-D5, LCD-D6, LCD-D7 )

//------------------------------------------------------------------------------------


void setup()
{
  //button adc input
  pinMode( BUTTON_ADC_PIN, INPUT );         //ensure A0 is an input
  digitalWrite( BUTTON_ADC_PIN, LOW );      //ensure pullup is off on A0
  //lcd backlight control
  digitalWrite( LCD_BACKLIGHT_PIN, HIGH );  //backlight control pin D3 is high (on)
  pinMode( LCD_BACKLIGHT_PIN, OUTPUT );     //D3 is an output
  //set up the LCD number of columns and rows:
  lcd.begin( 16, 2 );
  //Print some initial text to the LCD.
  lcd.setCursor( 0, 0 );   //top left
  lcd.print( "  Calculator    "  );

  lcd.setCursor( 0, 1 );   //bottom left
  lcd.print( "               " );
  delay(1000);
  Serial.begin(9600);
  Serial.print ("We are in setup");      //Testing purposes

}


void loop ()
{
  SelectingMenu = true;
  //function choice loop
  //----------------------------------------------------------
  while (SelectingMenu ==true)      
  {
    lcd.setCursor (0,0);
    lcd.print ("Function:              ");

    lcd.setCursor (0,1);

    FunctionChoice = Menu();        //Get value for FunctionChoice


    //Now we do something with the menu value we just got
    //case 0 and 5 provide looping

    switch (FunctionChoice)
    {
    case 0:
      {
        FunctionChoice = 4;
        menu = 4;
      }
    case 1:
      {
        lcd.print ("Add        (A+B)              ");
        break;
      }
    case 2:
      {
        lcd.print ("Subtract   (A-B)         ");
        break;
      }
    case 3:
      {
        lcd.print ("Multiply   (A*B)        ");
        break;
      }
    case 4:
      {
        lcd.print ("Divide     (A/B)            ");
        break;
      }
    case 5:
      {
        FunctionChoice = 1;
        menu = 1;
      }      
    }  //End switch
  }  // End while


  // So if we get here, this means that the select button must have been pushed.
  //FunctionChoice now holds the value of the function selected by the user.
  lcd.setCursor (0,0);
  lcd.print ("   Selection       ");
  lcd.setCursor (0,1);
  lcd.print ("   Confirmed            ");
  delay (1000);  

  //                         Get A and B
  //-----------------------------------------------------------------------------

  //Similar setup, this time get A and B. No looping

  SelectingMenu = true;
  while (SelectingMenu == true)                      //Get value for A
  {
    A = Menu();
    lcd.setCursor (0,0);
    lcd.print ("   Menu            ");
    lcd.setCursor (0,1);
    lcd.print ("A = ");
    lcd.print (A);  
    lcd.print ("                       ");  

  }
  lcd.setCursor (0,0);
  lcd.print ("   A: Selection        ");
  lcd.setCursor (0,1);
  lcd.print ("   Confirmed            ");
  delay (1000);  

  SelectingMenu = true;
  while (SelectingMenu == true)                      //Get value for B
  {
    B = Menu();
    lcd.setCursor (0,0);
    lcd.print ("   Menu                ");
    lcd.setCursor (0,1);
    lcd.print ("B = ");
    lcd.print (B);  
    lcd.print ("                       ");  

  }
  lcd.setCursor (0,0);
  lcd.print ("   B: Selection           ");
  lcd.setCursor (0,1);
  lcd.print ("   Confirmed            ");
  delay (1000);  


  //                       Compute and Output
  //------------------------------------------------------------------------
  lcd.setCursor (0,0);


  switch (FunctionChoice)
  {
  case 0:
    {
      FunctionChoice = 4;
    }
  case 1:
    {
      lcd.print ("Add        (A+B)              ");
      Add();
      break;
    }
  case 2:
    {
      lcd.print ("Subtract   (A-B)         ");
      Subtract();
      break;
    }
  case 3:
    {
      lcd.print ("Multiply   (A*B)        ");
      Multiply();
      break;
    }
  case 4:
    {
      lcd.print ("Divide     (A/B)            ");
      Divide();
      break;
    }
  case 5:
    {
      FunctionChoice = 1;
    }      
  }  //End switch

  lcd.setCursor (0,1);
  lcd.print ("Answer = ");
  lcd.print (Answer);  
  lcd.print ("                       ");  
  delay(2500);
  lcd.setCursor (0,0);
  lcd.print ("                  ");
  lcd.setCursor (0,1);
  lcd.print ("                       ");  
  lcd.setCursor (0,1);
} //End void loop
//                   END LOOP
//--------------------------------------------------------------------


//---------------------------------------------------------------------------------
//                         Computational Functions
//---------------------------------------------------------------------------------

int Add()
{
  Answer = A+B;
  return Answer;
}
int Subtract()
{
  Answer = A-B;
  return Answer;
}
int Multiply()
{
  Answer = A*B;
  return Answer;
}
int Divide()
{
  Answer = A/B;
  return Answer;
}


//--------------------------------------------------------------------------------------
//Allows the user to scroll up and down through a menu.
//User must provide looping and Display
//--------------------------------------------------------------------------------------

int Menu ()
{
  SelectingMenu = true;
  button = ReadButtons();
  if ( buttonJustPressed == true )  //If the button is pressed, store the value
  {
    scroll = button;
    Serial.print (button);   //Testing purposes
    buttonJustPressed = false;
  }

  if (buttonJustReleased == true)  //If the button is released, act on value
  {
    buttonJustReleased = false;

    switch (scroll)
    {
    case BUTTON_UP:
      {
        menu = menu +1;
        break;
      }
    case BUTTON_DOWN:
      {
        menu = menu - 1;
        break;
      }
    case BUTTON_SELECT:
      {
        SelectingMenu = false;
      }
    default:
      {
        break;
      }
    }  //End switch
  }    //End if
  Serial.println(menu);
  return menu;
}  //End Function


//-------------------------------------------------------------------------------------------------  


byte ReadButtons()
{
  unsigned int buttonVoltage;
  byte button = BUTTON_NONE;   // return no button pressed if the below checks don't write to btn

  //read the button ADC pin voltage
  buttonVoltage = analogRead( BUTTON_ADC_PIN );
  //sense if the voltage falls within valid voltage windows
  if( buttonVoltage < ( RIGHT_10BIT_ADC + BUTTONHYSTERESIS ) )
  {
    button = BUTTON_RIGHT;
  }
  else if(   buttonVoltage >= ( UP_10BIT_ADC - BUTTONHYSTERESIS )
    && buttonVoltage <= ( UP_10BIT_ADC + BUTTONHYSTERESIS ) )
  {
    button = BUTTON_UP;
  }
  else if(   buttonVoltage >= ( DOWN_10BIT_ADC - BUTTONHYSTERESIS )
    && buttonVoltage <= ( DOWN_10BIT_ADC + BUTTONHYSTERESIS ) )
  {
    button = BUTTON_DOWN;
  }
  else if(   buttonVoltage >= ( LEFT_10BIT_ADC - BUTTONHYSTERESIS )
    && buttonVoltage <= ( LEFT_10BIT_ADC + BUTTONHYSTERESIS ) )
  {
    button = BUTTON_LEFT;
  }
  else if(   buttonVoltage >= ( SELECT_10BIT_ADC - BUTTONHYSTERESIS )
    && buttonVoltage <= ( SELECT_10BIT_ADC + BUTTONHYSTERESIS ) )
  {
    button = BUTTON_SELECT;
  }
  //handle button flags for just pressed and just released events
  if( ( buttonWas == BUTTON_NONE ) && ( button != BUTTON_NONE ) )
  {
    //the button was just pressed, set buttonJustPressed, this can optionally be used to trigger a once-off action for a button press event
    //it's the duty of the receiver to clear these flags if it wants to detect a new button change event
    buttonJustPressed  = true;
    buttonJustReleased = false;
  }
  if( ( buttonWas != BUTTON_NONE ) && ( button == BUTTON_NONE ) )
  {
    buttonJustPressed  = false;
    buttonJustReleased = true;
  }

  //save the latest button value, for change event detection next time round
  buttonWas = button;

  return( button );
}

 

 

Sketch code

/*
  Example code for the Freetronics LCD & Keypad Shield:
 
    http://www.freetronics.com/products/lcd-keypad-shield
 
  by Marc Alexander, 7 September 2011
  This example code is in the public domain.
 ----------------------------------------------------------------------
  MODIFIED CODE
  by Maxx Eastick, 6th October, 2012
  The modified code released to the public domain.
  The modifications for use with the LCD shield purchased form Hobbking
 http://www.hobbyking.com/hobbyking/store/__25087__Arduino_LCD_Keypad_Shield.html
 
  Notes;
  If some buttons are not working, adjust the BUTTONHYSTERESIS value up until some start
  to work then attempt to adjust the button values from there to get more acurate results.
 
  Original code has been remarked out and noted.
 
  ---------------------------------------------------------------------
 
  This program demonstrates button detection, LCD text/number printing,
  and LCD backlight control on the Freetronics LCD & Keypad Shield, connected to an Arduino board.
 
  After powerup, the screen looks like this:
 
       ------------------
       |Freetronics 16x2|
       |Btn:          0 | <- This time value counts up the number of seconds since reset (overflows at 99)
       ------------------
 
  When a button is pressed, a label appears for it:
 
       ------------------
       |Freetronics 16x2|
       |Btn:RIGHT     0 |
       ------------------
       Labels are LEFT, UP, DOWN, RIGHT and SELECT-FLASH.
       SELECT-FLASH makes the LCD backlight flash off and on when held down.  
 
  Pins used by LCD & Keypad Shield:
 
    A0: Buttons, analog input from voltage ladder
    D4: LCD bit 4
    D5: LCD bit 5
    D6: LCD bit 6
    D7: LCD bit 7
    D8: LCD RS
    D9: LCD E
    D3: LCD Backlight (high = on, also has pullup high so default is on)
 
  ADC voltages for the 5 buttons on analog input pin A0:
 
    RIGHT:  0.00V :   0 @ 8bit ;   0 @ 10 bit
    UP:     0.71V :  36 @ 8bit ; 145 @ 10 bit
    DOWN:   1.61V :  82 @ 8bit ; 329 @ 10 bit
    LEFT:   2.47V : 126 @ 8bit ; 505 @ 10 bit
    SELECT: 3.62V : 185 @ 8bit ; 741 @ 10 bit
*/
/*--------------------------------------------------------------------------------------
  Includes
--------------------------------------------------------------------------------------*/
#include <LiquidCrystal.h>   // include LCD library
/*--------------------------------------------------------------------------------------
  Defines
--------------------------------------------------------------------------------------*/
// Pins in use
#define BUTTON_ADC_PIN           A0  // A0 is the button ADC input
// Original code removed as pin 10 controls this sheild
// #define LCD_BACKLIGHT_PIN         3  // D3 controls LCD backlight
#define LCD_BACKLIGHT_PIN         10  // D10 controls LCD backlight
// Original values for buttons
//#define RIGHT_10BIT_ADC           0  // right
//#define UP_10BIT_ADC            145  // up
//#define DOWN_10BIT_ADC          329  // down
//#define LEFT_10BIT_ADC          505  // left
//#define SELECT_10BIT_ADC        741  // right
//#define BUTTONHYSTERESIS         10  // hysteresis for valid button sensing window

// Added values by Maxx Eastick
// ADC readings expected for the 5 buttons on the ADC input
#define RIGHT_10BIT_ADC           0  // right
#define UP_10BIT_ADC            120  // up
#define DOWN_10BIT_ADC          280  // down
#define LEFT_10BIT_ADC          480  // left
#define SELECT_10BIT_ADC        720  // right
#define BUTTONHYSTERESIS         30  // hysteresis for valid button sensing window
//return values for ReadButtons()
#define BUTTON_NONE               0  //
#define BUTTON_RIGHT              1  //
#define BUTTON_UP                 2  //
#define BUTTON_DOWN               3  //
#define BUTTON_LEFT               4  //
#define BUTTON_SELECT             5  //
//some example macros with friendly labels for LCD backlight/pin control, tested and can be swapped into the example code as you like
#define LCD_BACKLIGHT_OFF()     digitalWrite( LCD_BACKLIGHT_PIN, LOW )
#define LCD_BACKLIGHT_ON()      digitalWrite( LCD_BACKLIGHT_PIN, HIGH )
#define LCD_BACKLIGHT(state)    { if( state ){digitalWrite( LCD_BACKLIGHT_PIN, HIGH );}else{digitalWrite( LCD_BACKLIGHT_PIN, LOW );} }
/*--------------------------------------------------------------------------------------
  Variables
--------------------------------------------------------------------------------------*/
byte buttonJustPressed  = false;         //this will be true after a ReadButtons() call if triggered
byte buttonJustReleased = false;         //this will be true after a ReadButtons() call if triggered
byte buttonWas          = BUTTON_NONE;   //used by ReadButtons() for detection of button events
/*--------------------------------------------------------------------------------------
  Init the LCD library with the LCD pins to be used
--------------------------------------------------------------------------------------*/
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );   //Pins for the freetronics 16x2 LCD shield. LCD: ( RS, E, LCD-D4, LCD-D5, LCD-D6, LCD-D7 )
/*--------------------------------------------------------------------------------------
  setup()
  Called by the Arduino framework once, before the main loop begins
--------------------------------------------------------------------------------------*/
void setup()
{
   //button adc input
   pinMode( BUTTON_ADC_PIN, INPUT );         //ensure A0 is an input
   digitalWrite( BUTTON_ADC_PIN, LOW );      //ensure pullup is off on A0
   //lcd backlight control
   digitalWrite( LCD_BACKLIGHT_PIN, HIGH );  //backlight control pin D3 is high (on)
   pinMode( LCD_BACKLIGHT_PIN, OUTPUT );     //D3 is an output
   //set up the LCD number of columns and rows:
   lcd.begin( 16, 2 );
   //Print some initial text to the LCD.
   lcd.setCursor( 0, 0 );   //top left
   //          1234567890123456
   lcd.print( "  Matthew's Stuff" ); //shamelessly promoting my Blog
   // Original code
   //lcd.print( "Freetronics 16x2" );
   //
   lcd.setCursor( 0, 1 );   //bottom left
   //          1234567890123456
   lcd.print( "Btn:" );
}
/*--------------------------------------------------------------------------------------
  loop()
  Arduino main loop
--------------------------------------------------------------------------------------*/
void loop()
{
   byte button;
   byte timestamp;
   
   //get the latest button pressed, also the buttonJustPressed, buttonJustReleased flags
   button = ReadButtons();
   //blank the demo text line if a new button is pressed or released, ready for a new label to be written
   if( buttonJustPressed || buttonJustReleased )
   {
     lcd.setCursor( 4, 1 );
     lcd.print( "            " );
   }
   //show text label for the button pressed
   switch( button )
   {
      case BUTTON_NONE:
      {
         break;
      }
      case BUTTON_RIGHT:
      {
         lcd.setCursor( 4, 1 );
         lcd.print( "RIGHT" );
         break;
      }
      case BUTTON_UP:
      {
         lcd.setCursor( 4, 1 );
         lcd.print( "UP" );
         break;
      }
      case BUTTON_DOWN:
      {
         lcd.setCursor( 4, 1 );
         lcd.print( "DOWN" );
         break;
      }
      case BUTTON_LEFT:
      {
        lcd.setCursor( 4, 1 );
        lcd.print( "LEFT" );
        break;
     }
     case BUTTON_SELECT:
     {
        lcd.setCursor( 4, 1 );
        lcd.print( "SELECT-FLASH" );    
        
        //SELECT is a special case, it pulses the LCD backlight off and on for demo
        digitalWrite( LCD_BACKLIGHT_PIN, LOW );
        delay( 150 );
        digitalWrite( LCD_BACKLIGHT_PIN, HIGH );   //leave the backlight on at exit
        delay( 150 );
        
        
        //an example of LCD backlight control via macros with nice labels
        /*LCD_BACKLIGHT_OFF();
        delay( 150 );
        LCD_BACKLIGHT_ON();   //leave the backlight on at exit
        delay( 150 );
        */
        
        
        // an example of LCD backlight control via a macro with nice label, called with a value
        /*LCD_BACKLIGHT(false);
        delay( 150 );
        LCD_BACKLIGHT(true);   //leave the backlight on at exit
        delay( 150 );
        */
        
        break;
      }
      default:
     {
        break;
     }
   }
   // print the number of seconds since reset (two digits only)
   timestamp = ( (millis() / 1000) % 100 );   //"% 100" is the remainder of a divide-by-100, which keeps the value as 0-99 even as the result goes over 100
   lcd.setCursor( 14, 1 );
   if( timestamp <= 9 )
      lcd.print( " " );   //quick trick to right-justify this 2 digit value when it's a single digit
   lcd.print( timestamp, DEC );
/*  
   //debug/test display of the adc reading for the button input voltage pin.
   lcd.setCursor(12, 0);
   lcd.print( "    " );          //quick hack to blank over default left-justification from lcd.print()
   lcd.setCursor(12, 0);         //note the value will be flickering/faint on the LCD
   lcd.print( analogRead( BUTTON_ADC_PIN ) );
*/
   //clear the buttonJustPressed or buttonJustReleased flags, they've already done their job now.
   if( buttonJustPressed )
      buttonJustPressed = false;
   if( buttonJustReleased )
      buttonJustReleased = false;
}
/*--------------------------------------------------------------------------------------
  ReadButtons()
  Detect the button pressed and return the value
  Uses global values buttonWas, buttonJustPressed, buttonJustReleased.
--------------------------------------------------------------------------------------*/
byte ReadButtons()
{
   unsigned int buttonVoltage;
   byte button = BUTTON_NONE;   // return no button pressed if the below checks don't write to btn
   
   //read the button ADC pin voltage
   buttonVoltage = analogRead( BUTTON_ADC_PIN );
   //sense if the voltage falls within valid voltage windows
   if( buttonVoltage < ( RIGHT_10BIT_ADC + BUTTONHYSTERESIS ) )
   {
      button = BUTTON_RIGHT;
   }
   else if(   buttonVoltage >= ( UP_10BIT_ADC - BUTTONHYSTERESIS )
           && buttonVoltage <= ( UP_10BIT_ADC + BUTTONHYSTERESIS ) )
   {
      button = BUTTON_UP;
   }
   else if(   buttonVoltage >= ( DOWN_10BIT_ADC - BUTTONHYSTERESIS )
           && buttonVoltage <= ( DOWN_10BIT_ADC + BUTTONHYSTERESIS ) )
   {
      button = BUTTON_DOWN;
   }
   else if(   buttonVoltage >= ( LEFT_10BIT_ADC - BUTTONHYSTERESIS )
           && buttonVoltage <= ( LEFT_10BIT_ADC + BUTTONHYSTERESIS ) )
   {
      button = BUTTON_LEFT;
   }
   else if(   buttonVoltage >= ( SELECT_10BIT_ADC - BUTTONHYSTERESIS )
           && buttonVoltage <= ( SELECT_10BIT_ADC + BUTTONHYSTERESIS ) )
   {
      button = BUTTON_SELECT;
   }
   //handle button flags for just pressed and just released events
   if( ( buttonWas == BUTTON_NONE ) && ( button != BUTTON_NONE ) )
   {
      //the button was just pressed, set buttonJustPressed, this can optionally be used to trigger a once-off action for a button press event
      //it's the duty of the receiver to clear these flags if it wants to detect a new button change event
      buttonJustPressed  = true;
      buttonJustReleased = false;
   }
   if( ( buttonWas != BUTTON_NONE ) && ( button == BUTTON_NONE ) )
   {
      buttonJustPressed  = false;
      buttonJustReleased = true;
   }
   
   //save the latest button value, for change event detection next time round
   buttonWas = button;
   
   return( button );
}

 





 

 

 Плата расширения L293D, ИК-датчик VS1838B, TFT LCD, Модем M590E GSM GPRS, "монитор TFT LCD, датчик движения HC-SR501, ИК-пульт дистанционного управления, Радиомодуль NRF24L01, SD Card Module, Звуковой модуль, 5-axis stepper motor driver, Шаговый двигатель, Модем M590E GSM GPRS, 5-axis stepper motor driver,  Часы реального времени DS 3231/DS 1307, терморегулятор W1209 DC, Релейный модуль, датчик движения HC-SR501, Модуль Wi-Fi ESP8266-12E,  датчик движения HC-SR501, Передатчик и приемник в диапазоне RF 433 Mhz, Блок питания, L293D, Микросхема контроллера коллекторного электродвигателя, ИК-пульт дистанционного управления, Датчики контроля температуры, Радиомодуль NRF24L01, OKI 120A2, Rotary Encoder, SD Card Module, Беспроводной пульт дистанционного управления, Микросхема контроллера коллекторного электродвигателя, Модуль Bluetooth HC-06,, Модем M590E GSM GPRS, Часы реального времени DS 3231/DS 1307, Mini 360 на схеме LM2596, MP3-TF-16P, L293D, Модуль LCD монитора, Инфракрасные датчики расстояния, Часы реального времени,  USB Host Shield, HC-SR501, Cветочувствительный датчик сопротивления, блок питания Mini 360 на схеме LM2596, ЖК-дисплей TFT дисплей, Контроллер L298N, HC-SR501, Модуль MP3 Player WTV020, GSM GPRS, Сервоприводы, Модем M590E GSM GPRS, Часы реального времени DS 3231/DS 1307, Модуль Wi-Fi ESP8266-12E, Инфракрасные датчики расстояния, Card Module, Ультразвуковые дальномеры HC-SR04, Блок питания,  Карта памяти SD, Mini 360, Ethernet shield, L293D, блок питания Mini 360 на схеме LM2596, Радиомодуль, датчик температуры DS18B20, ИК-пульт дистанционного управления, USB конвертер UART, ИК-пульт,  Антена для модуля WiFi, Ethernet shield,  Модуль блока питания XL6009, Микросхема контроллера коллекторного электродвигателя, Модуль качества воздуха MQ-135, Микросхема контроллера коллекторного электродвигателя, ИК-пульт дистанционного управления, SD Card Module, Радиомодуль NRF24L01, двигатель OKI,  5-axis stepper motor driver, L293D, TB6560, Драйвер шагового двигателя TB6600, Шаговый двигатель,  Модуль камеры, Блок питания, L293D, блок питания Mini 360 на схеме LM2596, 5axis mach3 interface, Карта памяти SD, Ethernet shield, Контроллер L298N, датчик движения HC-SR501, Модуль Wi-Fi ESP8266-12E, Модуль LCD монитора LCD1602, Шаговый двигатель OKI 120A2, Шаговый двигатель, Шаговый двигатель.

 

All Vintage Vinyl Records VinylSU.xyz

1.png2.png3.png4.png5.png