Posted on January 29, 2017January 30, 2017 by electromaniaweb
I will further extend my last project on serial communication by writing a program that controls the inbuilt LED in the arduino uno connected to the digital pin 13 through the serial monitor. The following program turns ON the LED when ‘1’ is sent to the board by the computer and turns OFF the LED when 2 is sent by the computer to the Arduino board. In all other cases it will print”invalid command”.
The string “invalid command” will be sent by the arduino to the computer in case of not receiving a 2 or 1 as the command programmed for the state of the LED. We can also send a group of messages (Strings) from the serial monitor to the arduino.
The code is pretty basic all I have done is that I added the if-else condition as per my requirements. Rest all the code is same as in my last project.
In the previous project and in this one I have introduced you ways in which you can interact with your board. This must have fascinated you in learning that you are able to comprehend the bit-by-bit data that you send and receive. There is beauty in understanding the basics, as I had already mentioned. Once you understand how or what governs a particular system we tend to be more curious about it and start understanding more and more. The cycle goes on, and we end up learning all about that particular thing. This is knowledge, this is the purest meaning of education. 🙂
Comments
Please log in or sign up to comment.