First I did some basic applications then I wanted to do serial port application. Of course I did it and it was really cool! After that I wanted to make it more cool and I decided to control devices over the serial port using mobile phones.
Let’s talk more in details about it!
As you know Telegram is a famous chat application that has a lot of users. Also they provide us some APIs to develop Telegram based applications.
Just write him “/newbot” then after a while you will get your own bot and token number. And then you will be ready to use your bot in your applications. For more details about how to create a bot take a look here.
In there example we implemented 5 commands: LedGreenOn, LedGreenOff, LedRedOn, LedRedOff and Button. As you can see, four commands are for controlling the two LEDs (Green and Red) on the MSP430 Launchpad and then we have the Button command to read the status of the user push button on the launchpad. Also the commands are not case sensitive, you can write them as you wish, upper or lower case. And if you write an undefined command, the application will notify you and list all the available commands .
Step 3: MSP430 Lauchpad Energia Application and Results
On the hardware side I used a simple MSP430 Launchpad and wrote code withEnergia to make it simple. It is simple code, when MSP430 receives the data over the serial port it also makes some checks . According to the input data it controls LEDs and checks the button status. Then it sends the required responses to NodeJS appliaction over the serial port.
So, as result I think that the Telegram bot API is really useful. You can do amazing applications. And of course, all the source files about this application are available here as github project.
See you next post “inşaallah”. Have a nice day!