About how to replace pictures in 21 Internet of Things Linux “gec6818” (with resources)

1. Basics

How to replace pictures

1. Find a picture, any format will do (I will give an example here: key.png)

2. Open this picture with Paint:

3. In Paint >> click “Resize” >> switch to pixel units, unlock the aspect ratio, and then enter the size >> The specific size is determined according to the size of the image you want to replace >> View the image You can know the size from the properties >> Save the picture as “24-bit bmp format, and have the same name as the picture to be replaced”:

adjust size

Enter the size (the specific value depends on the replacement image)

If I want to replace main.bmp, it should be saved like this

(The deletion and blue prompt images are not used in my code)

How to customize ui (requires some html knowledge)

1. Open the html file I wrote with an editor (preferably the HBuilderX we use):

2. Customize the UI by modifying pictures, background colors, font button styles, etc.

But note: Do not modify the positioning casually, this is bound to the code touch position!

Modify the corresponding resources to make UI

3. Take a screenshot manually, and then refer to the steps of “How to Replace Pictures” to change the picture to a 24-bit bmp format of corresponding size.

4. Run the program to check if it is normal.

If there is any abnormality, please check the following:

1. Whether the name of the picture is the same as before replacement.

2. Whether the image size is the same as the original image.

3. The image format, whether it is 24-bit, and whether the folder is placed correctly.

2. Advanced

How to increase the touch area

This part requires you to have more coding experience. Since time is tight, I will only give a brief overview here.

1. Get the coordinates: In the main function of the code, use getxy to obtain the x and y coordinates of the pressed screen. Based on this, write an if statement to increase the touch area, but be careful not to destroy the main function. loop structure, otherwise the code will not compile normally or functional errors will occur.

2. Display pictures: Show_bmp function in the code.

How to add functionality

When you can understand the functions of each code in the main function, you can try to add functions to it. Through the touch position principle mentioned above, we can use HTML to add a button ourselves, and then remember the position of the button. . You can achieve the functions you want by using existing functions such as obtaining coordinates and displaying images in the code. You can also obtain functional functions from other places and embed them into the main function.

3. (Please see) Commonly used Linux commands and paths

Common commands and how to copy and run programs using USB disk

Precautions:

1. Do not delete files in the root directory casually

2. If you want to transfer files to the board, it is best to create a folder in IOT

3. Before deleting, please think twice whether the folder is a system folder and do not clear the folder casually.

4. If the file name has a suffix, enter it in full. For example, 1.bmp cannot enter 1 (some computers will hide the suffix)

1. Enter the folder cd

//Enter the folder

cd folder name

//For example, I want to enter the 21wlw folder under the IOT folder
//Then this is:

cd /IOT/21wlw

2.Exit to the previous folder cd ..

cd ..
//Exit the folder

//You can also cd directly to the folder you want to go

3. View content ls

ls
//View all files and subfolders in the current folder

4. Delete rm

rm file name
//Delete a file under the folder

rm -r folder name
//Delete a folder under the folder

rm -r *
//Clear the current folder

5.Create the folder mkdir

mkdir folder name
//Create a folder

6.Copy cp

cp file name target folder path
//Copy a file to the target folder

cp -r folder name destination folder path
//Copy a folder to the target folder

7.Mobile mv

mv file name target folder
//Move a file to the target folder

mv -r folder name target folder
//Move a folder to the target folder

8. Unzip (zip format) unzip

unzip compressed package name
//Extract to the current folder

unzip compressed package name -d target folder path
//Extract to the specified folder

9. Run ./filename

./filename

//Execute the executable file. The executable file in the given code is main
//Then it is

./main

Please consult the manual for more commands.

How to transfer code to run on the board

1. How to connect the board

1. Install the usb to serial port driver (included with the file)

2. Open the device manager and check the COM port where the board is located.

COM6 port

3. Open SecureCRT and set as follows (choose your own port number)

4. After connecting, press Ctrl + C to exit the program that the board runs by default.

After pressing Ctrl + C, [root@GEC6818 /IOT]# pops up, which is the user name and current folder.

5. After [root@GEC6818 /IOT]# pops up, you can enter commands normally.

2. Several methods of transferring files to the board

1.Use the rx command to upload directly from the computer to the board. The advantage is that it is simple and fast. The disadvantage is that it is extremely slow and is not suitable for uploading large files, but if it is an update The main file, which is very small, can be used.

Enter rx file name

After entering the rx command, a C will pop up, which means waiting to receive files.

Then pull the file into the window

SelectX

Select the sending mode starting with X

Then wait for the transfer to complete

Start transfer
rx file name

//Upload files from computer to current folder
//For example, I want to upload a picture called 1.bmp
//So

rx1.bmp

//Then pull the file into the window and select the transfer mode starting with

2. Insert the USB flash drive and use the cd command to enter the /mnt/udisk/ folder of the board. This folder will display the contents of your USB flash drive.

cd enter ls view cp copy unzip decompress mv move…For details, please see “Common Commands”

You can directly copy the compressed package from the USB flash drive to a folder on your board to decompress it, or you can directly enter the USB flash drive to execute your code.

Note: If you enter the /mnt/udisk/ folder and use the view content command ls to find nothing, please check whether your USB disk system starts with FAT. The development board can only recognize this format. USB disk. Other formats are not recognized, such as exFAT.

3. Plug in the network cable, and then use fftp, but I don’t know how to do it, so I won’t write it.

3. How to run

Steps:

After inserting the USB flash drive, enter cd /mnt/udisk/ to enter the USB flash drive path.
Use ls to view the files in the current path. You can see the files on the USB disk.

If there is no file under this path (mnt/udisk), please read the second item of “How to Connect the Board”

Use the cp copy command to copy test03.zip to the 21wlw folder under the IOT folder
Use cd to enter the 21wlw folder
Check with ls, the compressed package exists

Use unzip to decompress the compressed package
After decompression, ls, you can see that the file has been decompressed, including main

Run the program

Enter chmod 0777 main to obtain permissions

Enter chmod 0777 main to obtain permissions

Enter ./main to run the program

Enter ./main to run the program

Run successfully

Run successfully