lcd touch screen light switch free sample
Does your home have a lot of built-in light fixtures, such as recessed lighting, chandeliers, or wall sconces? If so, replacing all those lights with smart lights can get expensive quickly. A more economical way is to install a smart light switch.
A smart light switch looks and acts like any traditional light switch or dimmer, but it can do a lot more. Once connected, you can control it from your smartphone, set schedules for when the lights should turn on and off, and connect them to other smart home devices using Alexa, Google Home, or Apple HomeKit.
Many of the best smart light switches even have a vacation mode, which will turn your lights on and off randomly to make it look like you"re home. But more than just safety, they can make sure you"re not leaving your lights on, which makes them one of the best smart home gadgets to save you money.
We"ve tested a number of smart light switches to find out which are the easiest to install and use, and which will fit the best with your home decor, if you don"t want your smart light switch to look too tech-y. As you"re going through our list and you"re looking for a smart light switch that can automatically turn the lights on when you enter a room, look for ones with motion detectors.
The Leviton Decora Smart WiFi Motion sensing Dimmer (D2MSD-1BW) is our favorite pick for the best smart light switch for those who want a dimmer switch with a motion sensor. We like its clean look and simple design, nice for those who want tech but don"t want their switches to look too gadgety.
You can set specific dimming levels for times of the day (such as a nightlight), can handle a wide range of lights including LEDs, CFLs incandescent, and the less common Magnetic Low Voltage (MLV) type. It also supports a large number of smart home platforms, including the big three: Amazon Alexa, Google Home, and Apple HomeKit. About the only thing we didn"t like is that it requires a neutral wire, which may be an issue for older homes.
The GE Cync Smart Switch isn"t the sexiest or sleekest, but it"s the best smart light switch because it gets the job done and is packed with features. The Wi-Fi-connected switch works with all kinds of bulbs, has apps for iOS and Android, and lets you control lights with a touch, voice, motion or remotely via a smartphone.
Installation, as with most other smart switches, requires a neutral wire, but it"s fairly straightforward. The switch includes an ambient light sensor (so it can be set not to come on in daylight) and a motion sensor to automatically trigger the light. The latter feature worked seamlessly. If you turn it off with the switch, after a few minutes it will engage the motion sensor again, or you can disable the sensor via the app in case you don"t want it switched on in the middle of the night.
The Brilliant touch-screen light switch lets you control not only your lights, but also other smart home devices, such as cameras, speakers and more. The panel has a large touchscreen, which you can use to look in on your security cameras, play music through smart speakers, and more. A touch-sensitive slider to one side is a simple way to change the brightness of the lights. Brilliant sells models with multiple sliders, in the event you have multiple light groups.
In addition, the panel has built-in motion sensors, so it can turn lights on and off as you enter and leave a room; a small camera lets you use multiple Brilliant panels as video intercoms. The Brilliant panel also works with a wide range of smart home systems, such as Alexa, Google Assistant, HomeKit, Ring, August, Ecobee, Honeywell, Sonos, Philips Hue, and Genie.
The Caséta line of switches from Lutron offers an impressive list of features: geofencing, which means your lights will automatically turn on or off when you leave or arrive at home; the ability to schedule your lights to turn on or off at particular times or days; dimming capabilities; and compatibility with a long list of smart home platforms. You can also control the system using your voice through Amazon Alexa and Google Home, among many others. It"s one of the best HomeKit devices, too.
Lutron"s smart starter kit comes with one in-wall switch, one wireless remote and one smart bridge (hub), which can also be used to connect other Lutron products to the cloud and control them.
The switch itself looks high-tech, with several buttons laid out to control the numerous options Caséta offers. Lutron has gone for function over fashion for the most part with this dimmer: The white and gray buttons are front and center, not hidden by touch-sensitive controls, as is the case with other dimmers in this category.
In some households, wall switches control an outlet, rather than a light fixture, so you can plug in a floor or table lamp, and then switch it on or off from your wall, rather than the lamp itself. But if you also use that outlet for devices that have to stay on all the time, like a clock radio, then you have to tape over the wall switch or resort to some other method to keep from accidentally flipping the switch and turning off power to everything connected to the outlet.
For those who have outfitted their homes with Philips Hue bulbs or don’t want to replace their wall switches, the Philips Hue dimmer is a handy little device. It can be used as a wireless remote or as a wall switch, but this switch doesn"t need any installation, apart from peeling the covering off the adhesive on its back.
This switch works with only Hue bulbs, though it"s almost magic when it does. Just turn on the light containing the Hue bulb as you normally would (even if it"s via a traditional wall switch); then, start using the Philips dimmer, and it will automatically work. And don"t worry — there"s no interference or conflict between the Hue Dimmer and your normal wall switch. The magic in the dimmer lies in the Philips Hue bridge, which is required ($59) for the dimmer to work (and is required for any Philips Hue system).
Calling a smart light switch Universal is a bold claim, but this Legrand switch gets pretty close, as it can communicate with the holy trinity of smart home systems: Apple Homekit, Amazon Alexa and Google Home. There’s no direct support for IFTTT or Zigbee devices, though.
The universal moniker also applies to what it is controlling, with Legrand claiming that it auto-detects and calibrates with LED, CFL, halogen, incandescent, and EFL bulbs. It can control up to 450W of LED and CFL or 700W of halogen and incandescent, which should cover most light sources. We tested it with a number of dimmable LED and incandescent sources and found that it worked as advertised, controlling these light sources without problems.
The paddle switch itself has a nice clicky feel to it, but it is smaller than most: those who like to bash paddle switches with the side of their hand may prefer the larger Leviton Decora switches. Next to the main switch is a dimmer switch, along with seven small white LEDs to show the dimming level. Next to this is the air gap switch, a tiny switch that turns the entire switch mechanism off when installing bulbs.
For those who have one of the best smart home hubs, the Jasco Enbrighten Z-Wave dimmer is a very good smart light switch. It"s a cinch to install, as there"s no neutral wire needed and the terminals are agnostic. A simple paddle switch handles both on/off duties as well as dimming functions.
The original Wemo Smart Dimmer had a cool LED status light, good construction, and we liked the app’s different lighting modes, including night mode. This time around, the dimmer loses the big status bar LED at the bottom and uses the ring around its power icon to accomplish the same task, which we believe is the right choice, making it just a little more classy in its appearance.
The switch retains the little finger groove that you slide your finger in to adjust brightness. It"s an intuitive control mechanism that is very satisfying to use — as you slide your finger, little dots along the groove light up to let you know to what percentage brightness you’re setting your bulb. Overall, it has a clean, simple design that even extends to the back of the device, which is now a touch shallower, making it easier to install. The color-coded wires coming from the back make for simpler installation as well.
As regards smart home compatibility, Wemo is broadly compatible, hitting all three major voice assistants and working with IFTTT. Wemo’s dimmer is very responsive to voice commands via Siri, our chosen test assistant in this case. However, certain smart home devices can be very finicky on some networks, and Wemo is no exception: In testing, it routinely became unresponsive to voice commands and the Home app and had to be reset. The problems disappeared when we switched it to a smart-home-friendly mesh network, but it’s worth noting that not all the smart home devices on the previous network had this issue.
If you use the Wemo app, you’ll find some nice features, such as long press to toggle other Wemo devices, and a schedule which sets the switch to a given brightness level if used during certain hours (this is the night mode we mention above). However, the app lacks two factor authentication; given that you can access Wemo remotely, this is inherently less secure. Because the switch retains its core functionality when solely connected to HomeKit, however, we can still recommend it.
First thing to consider is whether you need a smart light switch or a smart light bulb. The difference is, with a smart light bulb, you can control the bulb itself with your phone, rather than the switch. Because of this, smart light bulbs are a good option if you’re just trying to control a single light. If that’s the case, we’ve rounded up the best smart light bulbs to help you choose. You should also check out 9 things you never knew you could do with smart lights while you"re at it.
Smart light switches are a better option if you have lots of bulbs though or multiple rooms you want to control. They also tend to be much more cost efficient than splashing out for lots of smart light bulbs.
If you’re old school and your home is lit via floor and table lamps, then one the best smart plugs is likely the best option for you. You simply connect your lamp straight to it, and then the smart plug into your wall socket, no wiring involved! Smart plugs tend to be less expensive than smart light switches as well.
Smart light switches usually connect to your internet via Wi-Fi, Z-Wave, or Zigbee. Through Wi-Fi, your switch links to your router, whereas Z-Wave and Zigbee use smart home hubs. While the latter options mean you will need to purchase a separate hub, it does mean you will still be able to use the smart light switch when the internet is down. A new standard, called Matter, has recently come online; While there are only a few devices that currently have this enabled, we expect plenty more to come in the near future.
Some smart light switches will need a neutral wire to work. Homes which were built in or after the 1980’s likely will have one, but older homes might not. Because of this, it’s a good idea to check whether your home has a neutral wire before you make a purchase. If you’re unsure, here’s a breakdown onwhat’s a neutral wire and what to do if you don’t have one.
If a light fixture is controlled by more than one switch — for example, when you have a light switch at the top and bottom of a set of stairs — then you"ll need to get a three-way smart light switch. However, if there"s only one switch controlling an outlet, you can get a "single pole" switch.
Even if you don"t have a three-way switch, there"s an easy way to get around it; many smart light switch makers now offer a remote, or companion switch that"s battery-operated. All you have to do is attach the switch to your wall using screws or adhesive — no wiring required.
Some smart switches have a dimmer function, so you can adjust the level of the lights" brightness. While these generally cost more than non-dimmer switches, it"s nice functionality to have. If you do opt for a dimmer switch, you should also know that CFL, incandescent, and LED lights will all react differently — some LEDs may flicker if you dim them too much.
If you don"t want to bother actually pressing a light switch, then check out models which have built in motion sensors. These can sense your presence in a room and turn the lights on automatically. Just be sure that it"s in a place where it can sense you the entire time you"re in the room, or else it"ll turn the lights off on you!
Most smart light switches will work with Alexa, Google Assistant, or Apple HomeKit, so you can connect them to other smart home devices, and control them using your voice.
This is a feature we like: If a smart light switch has this feature in its app, it will automatically turn your lights on and off randomly while you"re away, to make it look like you"re home.
Unlike most smart home devices, which merely require you to plug them into an outlet, installing a smart switch involves replacing a current in-wall switch. Since few, if any, light-control products include professional installation as part of the package, you will need a basic understanding of electrical work, which includes turning off the circuit breaker.
Smart switches are often bulkier than their traditional counterparts, however; so if they don"t fit in the electrical box properly, you may need to get a new box, which is probably a job for an electrician. Similarly, some older homes don"t have the right wiring, so an electrician is a good idea here, too.
To test smart switches, we either installed them ourselves, or had an electrician install them in our house. We then evaluated the switches based on the following criteria:Design: Is it an attractive switch? The best will come in multiple colors to best match your decor.
Price: Smart light switches are generally more expensive than traditional switches, but even do, some offer more value than others. As they"ve become more popular, the price of smart light switches has dropped, so that most cost around $50-$60, though you can find models for less.Round up of today"s best deals
We also offer product sourcing and flight consolidation services. We have our own factory and sourcing office. We can provide you with almost every type of product related to our product range for Free sample for 1.1mm Thick Ito Coated Glass For Tp/lcd Sensors, We cordially welcome shoppers from at your house and overseas to join us and cooperate with us to appreciate a greater upcoming.
We also offer product sourcing and flight consolidation services. We have our own factory and sourcing office. We can provide you with almost every type of product related to our product range for 55"tempered Glass Panel/multi Touch Screen/touchscreen, Digitizer Glass Touch Screen And Lcd Panel For Transformer, Hot Sale 1.1mm Thick Ito Coated Glass For Tp/lcd, Each customer’s satisfactory is our goal. We are looking for long-term cooperation with each customer. To meet this, we keep up our quality and present extraordinary customer service. Welcome to our company, we’ve been expecting to cooperate with you.
Operator can easily direct the device without specialized technical training or computer knowledge by combining touch screen to LCD panel, plasma EL or other display.
touchscreen light switches come in a variety of colors and designs, and they can be used to illuminate the user"s home. Some light switches come with a / F buttons, and others are in line with their built-in light switches. They can also be used for video games, while video games and more are demanded.
These light switches come in various colors, sizes, and designs. For children and kids, touchscreen light switches are suitable for phone games, video games, and audio applications.
touch screen light switches are available in a variety of colors and designs. As a business, it is important to take the time to choose which touchscreen light switches are available to make the installation easier.
touch screen light switches come in a variety of colors and designs. They are easy to operate and can be used to illuminate the light, even if it is a built-in subwoofer and control.
Secondly, during the guarantee period, if the sample was due to switch quality issue, we can offer a sample to you for free. If the sample was damaged by your man-made mistake, then you can send to us to repair or purchase a new one. We will send new lights with new order for small quantity. For defective batch products, we will repair them and resend them to you or we can discuss the solution including re-call according to real situation.
Lanbon, a chinese company smart home tech company has released a series of Wi-Fi mesh connected touch switches with an LCD screen and some other accompanying devices.
I have received the L8-HS 5 in 1 LCD smart switch. 5 in 1 meaning you can choose between 5 existing modes and adapt the switch to your current needs. You can choose between a 1, 2 or 3 gang light switch with a max load of 200W per gang or completely switch it up and use it as a curtain switch for any kinds of motorised covers. Lastly you can forego using the relays completely and use it as a scene switch to remotely control other Lanbon devices.
Each mode will change the buttons displayed on the screen accordingly. With that you also have the option to modify the labels and icons for your switches as well as change the theming of the UI.
European version of the switch has an 86mm by 86mm front plate inside which is a 49mm by 59mm color LCD touch screen protected by a, I assume, acrylic plate. The front plate contains all the brains of the switch while the mains switching relays and power supply are in the back of the switch. There’s a thin white strip running through the middle of the front plate sides.
The LCD touch portion of the switch is attached to a metal plate with a slide and lock system. You simply slide it out to install the switch in your electrical box.
Everything needed for installation is neatly labelled and explained in the instruction booklet. I hooked it up in my testing board as a 3 gang switch and slid the front plate back on. After giving it power, the screen lit up and started booting with a Lanbon logo displayed. The thin white strips around the switch also lit up, seems they are some sort of status RGB LEDs and they color cycle while booting.
Switching worked out of the box but the Wi-Fi icon is red, which probably means I have to connect it to my Wi-Fi. Good ole instruction booklet tells me to long press on the Wi-Fi icon to get to the settings menu.
But there’s a different way, straight through the switch! There are three green dots at the bottom of the screen that are barely visible. Tapping there will start a Wi-Fi AP scan.
Click on your AP and enter the password using the full fledged on-screen keyboard. Entering the password isn’t that elegant since you need to scroll left and right on the keyboard but it works.
At the top of the screen is a status bar, similar to the one in our mobile phones. In the middle is a clock. To its right is the power monitoring data. On the left side is the Wi-Fi and mesh network status.
“Greenmode” automatically turns off the light after the configured interval. When “Greenmode” is active a green leaf icon is displayed in the status bar right of the clock.
You can set screen brightness and screen timeout time. Turn on Home Assistant support. Calibrate temperature offset. Choose between power consumption or current power used displayed on the main screen. You can also flip the display to landscape orientation. Of course, there’s the obligatory Factory reset.
And then there’s something called “epidemic report:”. After turning it on I can select a country. And with this I got a display of COVID stats for my country when the switch goes to sleep mode. Got to have a good reminder of how bleak the times are, just before turning on the light.
While the switch has quite a rich settings menu, not all features are available for setup. For that you will have to install the Lanbon SmartLiving app and register an account.
In the Change icon menu there’s an option to choose a local image or take a photo to, presumably, use as the icon for that switch. Sadly my version of the app simply crashes when I try to do that.
The less violating option. Open the App and go to Settings - Set Server and choose “Homeassistant Server”. Enter your local MQTT broker credentials there and the switch will inform you server settings have changes. You have to enable “Homeassistant support” in GUI settings so it starts broadcasting MQTT messages.
Now the switch is completely cut off from the cloud and communicates only locally. App will not work anymore until you disable Home Assistant support in the switch menu.
Lanbon claims the device will be autodiscovered but it is broadcasting the switch discovery message on the wrong topic. Lanbon assumes you will change discovery_prefix: in homeassistant but that is likely to break other MQTT discovery protocols, so the autodiscovery doesn’t exactly work. You need to configure the switch manually in .yaml.
The implementation is very basic. There is no availability topic or switch updates after a reboot so the state will not always be synced and you will not know if it goes offline or disconnects from the MQTT server.
There is no option to upgrade the firmware directly from the switch when a new version is released. Instead of that simple procedure you have to email the support staff with a request to allow you an upgrade. Once they get your switch information from the QR code they allow an upgrade and a new option appears in the settings menu for a limited time. If you wish to upgrade again you have to go through the entire process again.
Status LEDs on all 4 sides of the switch are an interesting feature which wasn’t thought out completely. Light diffusion is uneven, on top and bottom you can see the 4 LED’s while on the sides the light is nicely diffused into a single strip of light.
When you tap a button on the screen it informs you with a brief color change. If there’s something wrong (for example Wi-Fi is not connected) it glows red.
That is nice and useful but in my firmware version there were no options to control the way it is lit or turn it completely off. You can only put the switch into Night mode through the app which will turn the light off when the screen is off or dim it to a faint white when in use.
While the construction and the design of the switch is very good its usefulness is bogged down by the limited firmware, a clumsy GUI and a needlessly convoluted upgrade process.
Still, there is so much potential hidden in it and, luckily, the switch is based on ESP32 so who knows, maybe someone will start a good open source firmware project for it. I for sure will try installing Tasmota on it!
Brilliant supports LED, CFL, halogen, incandescent. Dimmable incandescent and LED lights also work. Brilliant does not support MLV lighting. There are features to help you perfect your lighting experience, such as auto-detecting your light capabilities, setting your dimmable range, and other adjustments to minimize or eliminate flickering. We have tested this with a wide range of lighting vendors to great success. Brilliant also works with numerous lighting products such as Phillips Hue, Lutron, and Lifx through the SmartThings Hub. See all
Yes, Brilliant supports dimmable incandescent and LED lights. There are also features to help you perfect the experience, such as auto-sensing your light capabilities, setting your dimmable range, and other adjustments to minimize or eliminate flickering. We have tested this with a wide range of lighting vendors to great success.
Yes, we support 3-way switching. You can set up a Brilliant to work with switches from another manufacturer in a 3-way configuration as long as that other switch is on/off, and not a dimmer. You can also set up multiple Brilliants in a 3-way configuration with dimming. Learn more
We support a wide variety of smart home products, and are always adding new partners. Our primary connection method is to use Wi-Fi for partner products like Sonos, Ring, Google Nest, Ecobee, Honeywell, Philips Hue, Wemo lights, August Lock, and smart plugs, and more. If you would like to connect to smart locks like Schlage, or already have Z-Wave or Zigbee products, we also support hubs from SmartThings so you can control them from a Brilliant. Amazon Alexa is already built in, so you just need to connect to your Amazon account. You can also use both Google Assistant/Google Home and Apple HomeKit devices to voice control the lights. See all partners
We designed Brilliant so that everyone (family and guests in particular) can quickly understand how it works with no training. Once you install Brilliant, you can swipe your finger up/down on the screen to turn on/off lights. For Brilliant Controls made to replace 2-4 switches, move your fingers up and down on the touch sliders. Adjusting the Sonos volume or music track that you are listening to has never been easier.
Brilliant supports LED, CFL, halogen, incandescent. Dimmable incandescent and LED lights also work. Brilliant does not support MLV lighting. There are features to help you perfect your lighting experience, such as auto-detecting your light capabilities, setting your dimmable range, and other adjustments to minimize or eliminate flickering. We have tested this with a wide range of lighting vendors to great success. Brilliant also works with numerous lighting products such as Phillips Hue, Lutron, and Lifx through the SmartThings Hub. See all
Yes, Brilliant supports dimmable incandescent and LED lights. There are also features to help you perfect the experience, such as auto-sensing your light capabilities, setting your dimmable range, and other adjustments to minimize or eliminate flickering. We have tested this with a wide range of lighting vendors to great success.
Yes, we support 3-way switching. You can set up a Brilliant to work with switches from another manufacturer in a 3-way configuration as long as that other switch is on/off, and not a dimmer. You can also set up multiple Brilliants in a 3-way configuration with dimming. Learn more
We support a wide variety of smart home products, and are always adding new partners. Our primary connection method is to use Wi-Fi for partner products like Sonos, Ring, Google Nest, Ecobee, Honeywell, Philips Hue, Wemo lights, August Lock, and smart plugs, and more. If you would like to connect to smart locks like Schlage, or already have Z-Wave or Zigbee products, we also support hubs from SmartThings so you can control them from a Brilliant. Amazon Alexa is already built in, so you just need to connect to your Amazon account. You can also use both Google Assistant/Google Home and Apple HomeKit devices to voice control the lights. See all partners
We designed Brilliant so that everyone (family and guests in particular) can quickly understand how it works with no training. Once you install Brilliant, you can swipe your finger up/down on the screen to turn on/off lights. For Brilliant Controls made to replace 2-4 switches, move your fingers up and down on the touch sliders. Adjusting the Sonos volume or music track that you are listening to has never been easier.
Lutron dimmer switches can enhance any family activity in your home by providing just the right light, at the touch of a finger. With over 250 lighting levels, creating the perfect light is easy, whether you’re tackling homework, sitting down to dinner, watching a movie, or sneaking in a late-night snack.
Explore two Show Homes – one in Brooklyn and one in Charleston – to see how designers and homeowners upgrade with Lutron dimmers to get just the lighting they want.
Dimmers work by adjusting the light output of bulbs, and just as it matters what dimmer you choose for reliable performance, it matters which bulb you choose, too. Check out our bulb compatibility tool to see which dimmer will work best with your existing bulbs, or which bulbs will work best with your new Lutron dimmer.
– By “Mom of Five,” 5-star verified Amazon review of Lutron Maestro LED+ Dimmer Switch for Dimmable LED, Halogen & Incandescent Bulbs (MACL-153M), 6/27/18
– By “Kwik-E-Mart,” 5-star verified Amazon review of Lutron Maestro LED+ Dimmer Switch for Dimmable LED, Halogen & Incandescent Bulbs (MACL-153M), 3/14/17
People who know the power of lighting know that Lutron dimmers are what to use to set just the right mood. See how decorators, stylists, and bloggers use our dimmers to get just the effect they want.
Our story began in the late 1950’s when Lutron’s founder, Joel Spira, set out to invent a device that would enable people to vary the intensity of electric light in their homes. The result? A solid-state dimmer that brought dimming out of the commercial domain and reliably into the home for the first time.
Today we hold over 2,700 patents worldwide, including those for hundreds of lighting and shading control solutions, and are the 1st choice of lighting professionals.* To take care of the customer is the first of five principles set forth by our founder and still embraced today. If you have questions or need help, our U.S.-based technical support team is available 24/7 at 1.844.LUTRON11.844.LUTRON1.
We’ve compared the PCBs and these seem to be exactly the same as the Lanbon-L8-HS switch. So the dimming occurs in the base and is controlled via the small pin-header.
In this Arduino touch screen tutorial we will learn how to use TFT LCD Touch Screen with Arduino. You can watch the following video or read the written tutorial below.
For this tutorial I composed three examples. The first example is distance measurement using ultrasonic sensor. The output from the sensor, or the distance is printed on the screen and using the touch screen we can select the units, either centimeters or inches.
The next example is controlling an RGB LED using these three RGB sliders. For example if we start to slide the blue slider, the LED will light up in blue and increase the light as we would go to the maximum value. So the sliders can move from 0 to 255 and with their combination we can set any color to the RGB LED, but just keep in mind that the LED cannot represent the colors that much accurate.
The third example is a game. Actually it’s a replica of the popular Flappy Bird game for smartphones. We can play the game using the push button or even using the touch screen itself.
As an example I am using a 3.2” TFT Touch Screen in a combination with a TFT LCD Arduino Mega Shield. We need a shield because the TFT Touch screen works at 3.3V and the Arduino Mega outputs are 5 V. For the first example I have the HC-SR04 ultrasonic sensor, then for the second example an RGB LED with three resistors and a push button for the game example. Also I had to make a custom made pin header like this, by soldering pin headers and bend on of them so I could insert them in between the Arduino Board and the TFT Shield.
Here’s the circuit schematic. We will use the GND pin, the digital pins from 8 to 13, as well as the pin number 14. As the 5V pins are already used by the TFT Screen I will use the pin number 13 as VCC, by setting it right away high in the setup section of code.
I will use the UTFT and URTouch libraries made by Henning Karlsen. Here I would like to say thanks to him for the incredible work he has done. The libraries enable really easy use of the TFT Screens, and they work with many different TFT screens sizes, shields and controllers. You can download these libraries from his website, RinkyDinkElectronics.com and also find a lot of demo examples and detailed documentation of how to use them.
After we include the libraries we need to create UTFT and URTouch objects. The parameters of these objects depends on the model of the TFT Screen and Shield and these details can be also found in the documentation of the libraries.
Next we need to define the fonts that are coming with the libraries and also define some variables needed for the program. In the setup section we need to initiate the screen and the touch, define the pin modes for the connected sensor, the led and the button, and initially call the drawHomeSreen() custom function, which will draw the home screen of the program.
So now I will explain how we can make the home screen of the program. With the setBackColor() function we need to set the background color of the text, black one in our case. Then we need to set the color to white, set the big font and using the print() function, we will print the string “Arduino TFT Tutorial” at the center of the screen and 10 pixels down the Y – Axis of the screen. Next we will set the color to red and draw the red line below the text. After that we need to set the color back to white, and print the two other strings, “by HowToMechatronics.com” using the small font and “Select Example” using the big font.
Now we need to make the buttons functional so that when we press them they would send us to the appropriate example. In the setup section we set the character ‘0’ to the currentPage variable, which will indicate that we are at the home screen. So if that’s true, and if we press on the screen this if statement would become true and using these lines here we will get the X and Y coordinates where the screen has been pressed. If that’s the area that covers the first button we will call the drawDistanceSensor() custom function which will activate the distance sensor example. Also we will set the character ‘1’ to the variable currentPage which will indicate that we are at the first example. The drawFrame() custom function is used for highlighting the button when it’s pressed. The same procedure goes for the two other buttons.
So the drawDistanceSensor() custom function needs to be called only once when the button is pressed in order to draw all the graphics of this example in similar way as we described for the home screen. However, the getDistance() custom function needs to be called repeatedly in order to print the latest results of the distance measured by the sensor.
Ok next is the RGB LED Control example. If we press the second button, the drawLedControl() custom function will be called only once for drawing the graphic of that example and the setLedColor() custom function will be repeatedly called. In this function we use the touch screen to set the values of the 3 sliders from 0 to 255. With the if statements we confine the area of each slider and get the X value of the slider. So the values of the X coordinate of each slider are from 38 to 310 pixels and we need to map these values into values from 0 to 255 which will be used as a PWM signal for lighting up the LED. If you need more details how the RGB LED works you can check my particular tutorialfor that. The rest of the code in this custom function is for drawing the sliders. Back in the loop section we only have the back button which also turns off the LED when pressed.