Code Motion Sensor with Different Programming Languages

Ravindra Rana
2 min readJun 11, 2020

--

Image by Gerd Altmann from Pixabay

Hello Internet, today I am going to post about C and C++ VS JavaScript in Embedded System and Internet of Things(IoT).

I am passionate about the Internet of Things(IoT) and Embedded Programming, it feels me happy while I am doing some stuff with hardware components.

If you are wondering to start learning IoT then you may start with Arduino Technology, it provides you some basic concepts about sensor and actuator after that you would hands dirty with ESP32 or ESP8266 and Raspberry Pi and so on.

I have done some projects like automation with ESP8266 and some projects like Digital Signage and making Web Server with Raspberry Pi.

C and C++ are the foundation of any programming language and mostly used by Embedded System.

But JavaScript has a huge area of development, it is everywhere nowadays from Web Development to the Internet of things(IoT).

In this post, I will show how C and C++ control the motion sensor and How JavaScript controls the motion sensor.

You will see the difference and analyze which one is best for you.

So before this, if you have not run any blink program using C and C++ or JavaScript then it’s a little bit difficult to understand so try to read this post if you want.

After reading these posts you have some basic concepts then let’s get started…

C and C++ Recipe

Step 1: Setup

We have to install the Arduino IDE. This video demonstrates how to install it.

Step 2: Code

Code for Motion Sensor, you may type or copy from here.

Step 3: Wiring

JavaScript Recipe

Step 1: Setup

You need to install some components before start Coding so follow this posts or google it for setup Johnny-Five.

Step 2: Code

Step 3: Wiring

Output

--

--

Ravindra Rana
Ravindra Rana

Written by Ravindra Rana

Web Developer | IoT Enthusiast

No responses yet