Relay module control light bulb brightness

Hello, everyone. I am working on a project about remote controlling the light bulb's brightness by using bluetooth, arduino and relay module. I wrote a code which use analogWrite()function to adjust the light intensity of some simple LED as an experiment, and the code actually worked out very successfully. So I want to know that will the code I used for controlling the small led would also be working for controlling the brightness of real incandescent light bulbs ? Can I adjust the brightness of these light bulbs by using the same code and just add a solid state relay module into the circuit ? Or there is more work to do just in order to dim real bulbs ?

I don't see how your question can have anything to do with the working of this website so I have suggested to the Moderator to move it to the Project Guidance section.

What is the voltage and current for the lamps you want to control? And do they work on AC or DC ?

...R

@guohaolu

Moved your topic to it's current location / section as it is more suitable.

Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

@Robin2

I am sorry for posting topics into wrong section,I was still confusing about how to use this forum,and I appreciate that you and moderator can correct my post in to proper location. For my project, the incandescent bulb that I use is around 5w/40w and 120v . I am not really controlling the lamp, but just the light bulbs

This will be short - I gotta' go...

Research how AC dimmers work .

A regular electro-mechanical relay won't work. Some "random phase" solid state relays will work. A "zero crossing" solid state relay won't work.

Regular PWM won't work. You need (electrically isolated) "phase detection" or "zero cross detection". You delay after the zero crossing and trigger the (optically isolated) TRIAC or solid state relay. The TRIAC stays-on 'till the end of the AC half-cycle where another zero-crossing is detected and everything starts over.