C++ – Using PHP or C++ for in real world electronic devices

cPHPprogramming-languages

I want to use my programing skills to make my day-to-day life easier, to do this I want to be able to program in my appliances like alarm clock or microwave or refrigerator, air conditioner etc, wish they had firmware that I could flash with my program to control them and adjust their work to my liking.

Right now I am limited with desktop or laptop you know when power goes down all you done is not there anymore.

I know in school they show how to program basic clock on electronics class with some 3rd party programming language, currently I assume there are 10's of different programming languages for devices and I don't want to learn different language for each device, wish there was like API on each device that I can use with whatever programming language I normally use e.g. PHP.

I am basically looking for way to adjust /expand functionality of real life standalone electronics (without connecting them to PC or using virtual analogue) learning programming language company used when created it.

Are there any appliances that support this or is there some language converter I can add to make it possible?

P.S. Currently there are Raspberry PI computers for $40 bucks that fit in hand perhaps I can create my own say alarm if I put it in a box and attach speaker to it and then program is with using PHP or it's currently not possible?

Not interested in inventing anything, just wondering if there are ready tools / ways to customize application firmware without learning their specifics today?

Best Answer

This is a quick article about the relationship between APIs and hardware.

Generally, if you are accessing hardware directly, you would generally use a C or C++ driver. You might raise the question: how do all the other languages access the hardware? They utilize the C or C++ compiled driver.

EDIT: One of the commenters provided a list of high-level language compilers and interpreters for microcontrollers, so my statement was outdated. These would give you the options of using Embedded Java, Python, Lisp, etc. It would be interesting to investigate if each of the interpreters is tightly coupled to a processor, or if it is as simple as a recompile by processor.

Does this mean you need C and C++ for anything you do? Yes and no. It depends upon the APIs available to you. A C driver may have a C# wrapper around it, and you can do what you need in C#! I was on a C# project, and we had a couple C# wrappers for C++ libraries. However, if you are really interested in programming specifically for the hardware, you will not be able to use an interpreted language (as is PHP) or a non-native language (Java). You will need to run native, as compiled C or C++ does.

And this really assumes that you are creating your own clock, light, microwave, etc. I suppose a Raspberry PI machine would do -- or would be an accessible overkill -- for what you want to do. If you want to control a commercial product, the manufacturer needs to provide you an interface to manipulate their product.

Related Topic