Turn on a light, or 10. Arduino control over serial
This is something I use all the time, so I figured I would share it with you. Controlling an Arduino over serial can be extremely simple if you let it, and extremely useful if you know how to use it. Many languages such as Processing and ActionScript 3 (with a proxy) have ways to communicate over serial, and typically you see people using this so they can display the output of an Arduino, or use firmata to send information to the arduino but end up loosing a lot of programming space and overcomplicating the arduino side. But, you can go the other way and build interfaces that are able to control the arduino without firmata and pretty easily at that.
This may sound totally obvious, and it may be, but I’m going to show you anyways. For this example I’m going to use the serial monitor built in to the Arduino software, but you can use anything that will write serial to the Arduino. And, although I’m only showing the hookup for LEDs, bildr is all about simple things that you can easily expand / change to make something really cool. So, not to leave you out in the cold, I’ll talk about next steps and how you could expand on this in a bit.
Keeping it simple
Sending a long serial string in Arduino is super simple ( Serial.print(“Hello”) ) , but reading one is a little more difficult. To simplify things, the commands we will send to the Arduino will all be single character. It may sound limiting, but you have 100 or so usable single characters (about 200 if you use special characters) so you can call that many functions over serial in like 3 lines of code. Later in the article, I will also use the single character calls as an advantage other than just saving coding time.
For more detail: Turn on a light, or 10. Arduino control over serial
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw