Инструменты пользователя

Инструменты сайта


arduino_2017

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

arduino_2017 [2018/01/16 15:29]
Sergey Kondrashov [Сирена на Arduino]
arduino_2017 [2018/01/23 17:10] (текущий)
Sergey Kondrashov [Усилитель НЧ D-класс 2.1, 2х50Вт, 1x100Вт (TPA3116)]
Строка 180: Строка 180:
 https://​www.electronshik.ru/​item/​kit-mp3117box-2564174 https://​www.electronshik.ru/​item/​kit-mp3117box-2564174
  
 +<​code>​
 +/*
 +  LiquidCrystal Library - scrollDisplayLeft() and scrollDisplayRight()
 +
 + ​Demonstrates the use a 16x2 LCD display. ​ The LiquidCrystal
 + ​library works with all LCD displays that are compatible with the
 + ​Hitachi HD44780 driver. There are many of them out there, and you
 + can usually tell them by the 16-pin interface.
 +
 + This sketch prints "Hello World!"​ to the LCD and uses the
 + ​scrollDisplayLeft() and scrollDisplayRight() methods to scroll
 + the text.
 +
 +  The circuit:
 + * LCD RS pin to digital pin 12
 + * LCD Enable pin to digital pin 11
 + * LCD D4 pin to digital pin 5
 + * LCD D5 pin to digital pin 4
 + * LCD D6 pin to digital pin 3
 + * LCD D7 pin to digital pin 2
 + * LCD R/W pin to ground
 + * 10K resistor:
 + * ends to +5V and ground
 + * wiper to LCD VO pin (pin 3)
 +
 + ​Library originally added 18 Apr 2008
 + by David A. Mellis
 + ​library modified 5 Jul 2009
 + by Limor Fried (http://​www.ladyada.net)
 + ​example added 9 Jul 2009
 + by Tom Igoe
 + ​modified 22 Nov 2010
 + by Tom Igoe
 +
 + This example code is in the public domain.
 +
 + ​http://​www.arduino.cc/​en/​Tutorial/​LiquidCrystalScroll
 +
 + */
 +
 +// include the library code:
 +//#include <​LineDriver.h>​
 +#include <​LiquidCrystal.h>​
 +//#include <​LiquidCrystalRus.h>​
 +//byte bukva_F[8] ​  = {B00100,​B11111,​B10101,​B10101,​B11111,​B00100,​B00100,​B00000,​};​ // Буква "​Ф"​
 +// initialize the library with the numbers of the interface pins
 +LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
 +
 +void setup() {
 +  // set up the LCD's number of columns and rows:
 +  lcd.begin(16,​ 2);
 + // lcd.createChar(9,​ bukva_F);  ​
 +  // Print a message to the LCD.
 +  lcd.setCursor(0,​0);​
 +  lcd.print("​HOBA\xB1 \xA5H\xAAOPMAT\xA5KA! \xA8""​EPE""​\xA4""​A""​\xA1P\xA9\xA4KA!"​);​
 +  //​lcd.print("​\xE0\xE1\xE2\xE3\xE4\xE5\xE6"​);​
 +  //​lcd.print("​\xA0\xA1\xA2\xA3\xA4\xA5\xA6"​);​
 +  //​lcd.print("​\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0"​);​
 +  //​lcd.print(" ​    \xA8 p \xB8 \xB3 e \xBF"​);​
 +  //​lcd.print("​xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF/​\xE1\xE2\xF7\xE7\xE4\xE5\xF6\xFA\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF2\xF3\xF4\xF5\xE6\xE8\xE3\xFE\xFB\xFD\xFF\xF9\xF8\xFC\xE0\xF1\xC1\xC2\xD7\xC7\xC4\xC5\xD6\xDA\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD2\xD3\xD4\xD5\xC6\xC8\xC3\xDE\xDB\xDD\xDF\xD9\xD8\xDC\xC0\xD1"​);​
 +
 +  delay(1000);​
 +}
 +
 +void loop() {
 +  // scroll 13 positions (string length) to the left
 +  // to move it offscreen left:
 +  for (int positionCounter = 0; positionCounter < 30; positionCounter++) {
 +    // scroll one position left:
 +    lcd.scrollDisplayLeft();​
 +    // wait a bit:
 +    delay(300);
 +  }
 +  ​
 +/*
 +  // scroll 29 positions (string length + display length) to the right
 +  // to move it offscreen right:
 +  for (int positionCounter = 0; positionCounter < 34; positionCounter++) {
 +    // scroll one position right:
 +    lcd.scrollDisplayRight();​
 +    // wait a bit:
 +    delay(300);
 +  }
 +
 +  // scroll 16 positions (display length + string length) to the left
 +  // to move it back to center:
 +  for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
 +    // scroll one position left:
 +    lcd.scrollDisplayLeft();​
 +    // wait a bit:
 +    delay(300);
 +  }
 +
 +  // delay at the end of the full loop:
 +  delay(300);
 +*/
 +}
 +
 +</​code>​
arduino_2017.txt · Последние изменения: 2018/01/23 17:10 — Sergey Kondrashov