Hello!
This article contains the source code of the application for the iOS operating system, which aims to control the LED strip WS2801 connected to the Raspberry PI.
The
pbelov article “
Managing LED strip with Raspberry Pi and Android” served as the basis for this post.
Habrahabr.ru/post/203532 . If you need to familiarize yourself with the basic principles of connecting tapes with WS2801 chips to a Raspberry PI, it’s better to start reading from the original article by Pavel.
Some time ago I became interested in the organization of lighting in the house. The search for ready-made software solutions yielded results, but I wanted more freedom in customizing the RGB tape. In particular, existing solutions were deprived of the ability to customize custom animations, creeping lines, or flowing one color into another. For this reason, it was decided to take up the creation of a custom application with advanced functions for adjusting colors, the order of colors in the ribbon and their smooth animation.
')
Project repository
github.com/PawelMolodkin/HomeLedThe root folder of the repository contains the client iOS project for Xcode, and in the ledserver folder there is the project of the server application for IntelliJ IDEA.
The ledserver / putty folder contains life-friendly scripts written to automate the pouring and debugging of a server application on raspberry.
Client part
This is what the whole program looks like.

The first cell adjusts the color of the entire tape.

The second cell is used to create color lists.

You can select any colors one by one, then save the list, giving it a name. Saved lists will be needed to set up animation.
The third cell combines two functions: linear animation and animation of smooth alternation of color lists created in the second cell.

The "Enable Animation" Toubler launches a linear animation. Spinner can change the speed of linear animation.
List animations are a bit more complicated.
First you should have several color lists saved in the second cell. Then we tap on the button "Animation of color". In it we add the necessary lists in the order in which you want the colors to change. Then return from the add list dialog. Now click “Save” and enter the name of the new animation.
To activate the saved animation, click "Load" and select the color list animation we need.
Server part
The server is started by the command
java -jar ledserver.jar 50
Where the number 50 is the number of diodes in the tape.
The server listens to UDP port 8090. UDP was chosen to more easily integrate the server into the local network, as it is configured to listen on the broadcast channel, therefore if your iPhone and Raspberry are connected to the same router, you do not even have to enter the correct Raspberry IP address in iOS, the server will still receive its messages from the client.
Debugging
For ease of desktop development and debugging on a remote Raspberry PI, create a Remote debug configuration in IDEA.

For 'external tool', select 'Run External Tool', then the putty / launch-led-server.bat script. Remember, in the launch-led-server.bat script you should enter the correct IP addresses of your Raspberry. Also, the ssh public key must be added to the raspberry, so that the putty can automatically authenticate itself via the pagent to upload the new .jar and use it.
Thank you for attention!