Рет қаралды 34,330
Sketch of the project kolotushkin.com/article.php?id=26
Projects based on Arduino Nano:
Automatic drive for quadrocopter chassis • Автоматический привод ...
Doorphone key duplicator • Дубликатор домофонных ...
How to remake the servomotor from 180 to 360 degrees • Как переделать сервомо...
Control of two unipolar stepper motors via Bluetooth • Управление двумя унипо...
Homemade RGB controller for 2 RGB tapes • Самодельный rgb контро...
Useful programs:
Arduino IDE for beginners • Arduino ide для начина...
Arduino UnoArduSim Simulator • Лучший симулятор Ardui...
One of the subscribers asked me to make an example of a menu for Arduino, which should be displayed on a 2-line 16-character I2C LCD display.
So that using the buttons, you can navigate through the menu, for example, control LEDs and some kind of simple program.
The basis of the project is the Arduino Nano board, and the I2C LCD display, I also use 4 buttons, 5 low-power LEDs, 5 resistances at 500 ohms, a breadboard, and connecting wires.
On the video I show how it works, and explain the contents of the sketch so that it would be easier for you to navigate.
I use 4 buttons for control, “OK”, “EXIT”, “UP”, and “DOWN”.
When the Arduino board is turned on, the main page is displayed.
Click OK, and we get into the menu with five blocks.
Here you can move in a circle both in one direction and in the other direction. Having selected the block of interest, click OK, and we get into the block with the setting.
You can go back to the main one by double-clicking the exit button, or by pressing and holding the exit button.
If you open the fourth program, we will see the inscription “Blink”. I signed it like that, because this program turns on and off the green LED, just as it does in the standard Blink example.
Instead of just turning on the LEDs, you can program some algorithms, and organize the ability to control and configure these algorithms.
Initially, the sketch is not suitable for the Arduini Nano board !!!
The fact is that the UnoArduSim application in which the sketch was created and tested only supports the Adafruit_LiquidCrystal.h library, and the Arduino NANO board into which this sketch will be loaded does not support this library.
I will replace it with the LiquidCrystal I2C library. I will indicate the library object with the name lcd, as well as the I2C address, and the size of the LCD display.
To initialize the display, you need to delete the contents of the brackets, and specify the init command here.
Even before void loop (ohm), you need to declare the function void blink4 (), otherwise when compiling the sketch, the Arduino IDE application will throw an error.
Also, an error may be generated if you do not have the LiquidCrystal I2C library. This can be fixed in two ways: connect the library that you have, or download this library through the Sketch tab / connect library / manage libraries.
After updating the list of libraries, in the search window write the query LiquidCrystal I2C. Find this library in the list, highlight it and click install.
My install button is missing, because the library is already installed. When the library is installed, close this window and you can upload the sketch to the board.
When the sketch loads, you can connect the display to pins A4 and A5. We connect the LEDs to the contacts indicated in the sketch, in my case it is 0, 1, 2, 3, and 4.
Buttons are also connected to the contacts that were indicated in the sketch, in my case they are 14, 15, 16, and 17.
Then we connect the power, and check.
THANKS FOR BROWSING, AND BEFORE MEETING IN THE NEXT VIDEO!
#arduinoprojects #lcd #arduino