Tuesday, February 21, 2017

Wicked Devices Nanode with Sketchgarden - How to Flash it to be used as a Arduino UNO

MCM Electronics is selling a Sketchgarden/Nanode board for $10.00.  Unfortunately the idea behind the sketchgarden firmware is long gone.  The board is a older board, but it has a ATMEGA328 and a Ethernet port on it - the headers I believe are not Arduino R3 comparable,  which means that some shield will not work with it, that is still ok.

In order to make the board useful, you have to flash the UNO bootloader on it, because it's a ATMEGA328 and not a ATMEGA328P the usual way to flash the new bootloader doesn't work.

I put together a short (17 min) video of how to flash it, it's not hard to do, but does require some extra steps.

As I said in the video, there isn't a lot of information about the board any more, and here is everything I found and what you may need if you want to flash the new bootloader.

Arduino as ISP

Step 5 & 6 Bootload an Atmega328 by Andy Tallack


Wicked Device Tutorial (Sadly out of date)

JeeLabs Ethercard library info
(This page suggests the CS pin is already PIN 8, the Github repository 
says it's PIN 10, which maybe why I had to change it)
(I think this page is out of date as well)
CS pin is 8 for this board.

Ethercard Library

Friday, January 27, 2017

X-Minus One - A Logic named Joe - My Thoughts.

X-Minus One A Logic Named Joe!

Original a revival of Dimension X, X-Minus was a NBC Radio Drama series, in the early 1950s.
Think Twilight Zone (or The Outer Limits), with no pictures (and arguable worse ideas for episodes).
Actually, if you have been around Sci-Fi at all even if you don't know X-Minus you probably know the stories, many of them were adapted for Twilight Zone, The Outer Limits, and yes even Star Trek re-told some of these stories.  So arguable X-Minus was bad, most of the stories were complete fiction, and really didn't even have any basis in logic or science.
But it was the best kind of bad, with some of todays best Sci-Fi authors being featured,
Issac Asimov, Ray Bradbury, and Philip K. Dick, just to name a few.

For a little more about X-Minus one - https://en.wikipedia.org/wiki/X_Minus_One

A Logic Named Joe original did appear (or I should say was heard) on Dimension X. July 1, 1950 It was reaired under the X-Minus One title on December 28, 1955. And was made by Murray Leinster (Dimension X/X-Minus One adaptation by Claris A. Ross)

This is one of my favorite episodes from the serial, why? Because in 1950/1955 it describes some many things that we have now, thou you might have to warp your brain a little to see it.

A few things to remember (or realize): One of the first digital computers was Colossus in 1943, And the ENIAC was completed in 1946. There were programmable computers before this, The Turing Machine proposed in 1936, and the Z1 in 1936/1938.  The first computer to store a program was in 1949. And the first commercial computer (computer for sale) was the Z4 in 1950. Of course the word computer and computing devices date as far back as the 1600s, but let's stick with a little more modern use of the word. The first computer with RAM was a Whirlwind Machine in 1955.

So why is this history important? Well, you have to remember that at the time "A Logic named Joe" was written, computers were still very new, 12 years old or less, and computers that could store and retrieve the stored information were even newer (or had not yet been made).
Also remember that normal computer terms were not in the every day vocabulary. Also, remember that computers of this era were the size of buildings, the first small computers were in the early 70s or late 60s - and even then I wouldn't call them portable, just smaller than a room.

It's important to remember these things when you hear the story.

So, listen to the story above, and come back to hear some of my thoughts on what is possibly the best Dimension X/X-Minus One story told.

More Information:

My thoughts: (All opinion are my own, this is my take on the episode, yours may be different.)

1. A Logic is of course a small desktop style computer, it must be big enough thou requiring a couple of people to carry it, and needing a small truck to move it. But at a time when computers were the size of a building (or at very least a room), it speaks to a time when computers could be "easily" moved.
2. A Logic is in nearly every home. And there are PUBLIC Logic terminals. In today's world, nearly everyone has at least one computer, and libraries have computers for PUBLIC use.  PUBLIC wifi can be found at most business locations, and restaurants. In effect creating a PUBLIC network for computing devices.  So in 1950, the author predicts computers in every home. And the use of PUBLIC terminals. And although or computing devices are quite a bit different (namely in size and shape), we do have PUBLIC access/usage and nearly everyone has at least one computer.
3. A Logic can communicate with other Logics, with a Set of Central Information Repositories.  Today, we have a Global network of computers that communicate with other computers. Without knowing what to call it, and years before ARPAnet (1973) came online - The author was describing the GLOBAL INTERNET. (Just in case you don't know ARPAnet eventually became the Internet we know now, that was early 1990s). There are Central Information Repositories now, in the form of various types of servers, and databases.
4. A Logic looks like a TV with it's knobs replaced with a keys, and a VOICE interface. The logic is even described as being able to replace your TV for entertainment, and used to place video phone calls.  In todays world, it's nothing to get on youtube, netflix, or hulu and watch countless hours of TV for entertainment. Skype, Hangouts, Google Voice, VoIP can all be used to place phone calls, some even video calls. We have Siri, Google Now/Assistant, Amazon Echo, Microsoft Cortanta, all VOICE interfaces. In 1950 a voice interface would have been very hard to do, thou I am sure people studying the computer field wanted it.
5. A Logic uses SPEECH to convey information. By this point you probably see where I'm going here. In fact computer Speech didn't really happen until 1961, even then it wasn't great speech.

Of course today, we have text to speech and speech to text, even speech to speech interfaces, information is effortlessly conveyed using speech.
6. A Logic can rapidly find and correlate information based on your request. Again, I've already touched on this a little, but the most obvious thing to think of is "Google Search". Google is very good at rapidly finding and correlating information based on your search terms. This is all done using various Google services, servers and databases, and all happens in milliseconds.

7. While we aren't quite to this point yet, A logic can put together information in such a way that no-one else has thought of, coming up with new formulas for getting rid of liqueur in your blood, or creative ways to rob your bank, or kill your boss. We do have Artificial Intelligent machines now, that have come up with new ways to think about something, because of how they correlate information. (IBMs Watson a very impressive A.I.)

The author must have either had a very creative mind, or a very logical one to see the direction computers were going as early as it was.

In conclusion, "A Logic Named Joe" holds up very well in today's world, and is one of my favorite episodes of X-Minus One. This is one work that should be updated for a modern audience. (Hint Hint, creative types out there, you know who you are.)

Please feel free to leave your thoughts on this great episode.

It's 2017! and....

Well, here we are again, another new year.  And every year I say "I'm going to post more to my blog." - and well fail at it almost every year.
You know at the start way back in 2010/2011 this was fun, it was new, it was a great way to share information to the masses.
It still is, but now it's 2017 - times have changed, Blogs that aren't fancy don't get a lot of traffic, I've always tried to keep mine simple and just convey some information I find useful.
I don't see any reason to change now (Well except for actually posting a blog).

Over the years things have changed a little - This blog started as just "stuff" I thought about, pretty much random, it slowly changed to information about my robotic projects, and Arduino project - then things to do on linux computers, or linux distros to try.  Finally it ended up back where it started, just on some of my random thoughts.  At one point I consider changing the name of the blog to "Random Wire."  I found out that someone else is using it, so... We will just keep it as the "KD8BXP's Blog"

You'll find (I hope) interesting things about robotics, arduinos, computers, linux, and a few of my random thoughts.  I do post on Youtube a LOT! Probably more than I should, I'd like to try and tied my Youtube following into my blog.  So when I post a project on youtube I will have some documents here for it (Hopefully I follow though with that this year!)

And hopefully this year will be different, and I really start using this blog to it's full potential.

Thanks for following the rant! and have a great 2017.

Friday, November 11, 2016

Using FireFly FireDuino on a Linux Machine.

I just got my Fireduino board (maybe 3 or 4 days ago Nov 7 or 8th 2016), and found it not as straight forward to setup and use in linux as one would think, this is what I learned, and how I got it too work, as well as some other information that you might find helpful if you have this board.

Setup arduino with board manager



How to disable driver signature in windows 10

Possible fix for linux?
Install rkflashtool from synaptic package manager

Working method for linux:
This error:
/bin/sh: 0: Illegal option --
has something to do with the default shell being dash, not bash in Ubuntu, and Ubuntu based systems.
I found a "fix" for that here -

OK - So Here is the deal - I did get it this to work in linux, without any drivers, but it wasn't as straight forward as it should have been.
Quickly -
I followed the "hold reset", "push upgrade", "release reset", "release upgrade" - then I hit reset again and a serial port does show up (/dev/tyyACM0)
The IDE has to be run as admin (root), (Issue here is, it uses default sets, an you have to add the board back in the board manager)
Next, There are 3 files that need to have the permissions changed.
The easiest way is in the shell
cd /root/.arduino15/packages/Firefly/tools/fireduino_tools/1.0.0
chmod 744 rkImageMaker
chmod 744 upgrade_tool
chmod 744 update_tool

This seemed to work for me, I've been able to upload the audio_play_NET sketch, the blink sketch, and a couple others.
I'm using the Arduino 1.6.12 IDE - and this was done on a different linux box, than any of my above posts.

Thursday, February 25, 2016

Could Spencer Reid be related to either The Lone Ranger or Sherlock Holmes or Both?

Normally, I do some type of blogging about electronics, radios, or robots, this one is a little different, and something that I've been thinking about for some time now.

Here my little theory on Spencer Reid from Criminal Minds:

So a little background for those who have been living in a box, under a rock or on the other side of the moon for the past 50 plus years, and have no idea who the Lone Ranger, Sherlock Holmes or Spencer Reid are.

1st The Lone Ranger - he is a fictional masked former Texas Ranger who fights outlaws in the American Old West. His first appearance was in 1933 radio drama, and was inspired by Zane Grey's "The Lone Star Ranger" from 1915.
A bit of the back story - He and a group of other Rangers including his brother, were ambushed by the Cavendish gang and left for dead.  There are two different versions of the back story, one where he is the only survivor, the 2nd where him and his brother are the only survivors.  His first name is left to a little speculation, most believe it to be John, his last name is Reid. And his brothers name is Dan or Daniel Reid.

What's important about his brother surviving the ambush, is that He had a son that went on to have a son named Brett Reid.  Brett Reid went on to carry out his uncles legacy with the Green Hornet. The Green Hornet went on to have children, that carried on that legacy.

So that is a little background on The Lone Ranger.

Next we need to talk a little about Sherlock Holmes was created by Sir Arthur Conan Doyle,  He was a "consulting detective",  And worked a number of "baffling" cases, the general setting was in the late 1880s. Attempts have been made to "remake" the great detective in modern times with some successes and some not so successful attempts.  What makes Sherlock special was/is is ability to make connections (deductions), see clues that others don't see, and bring a modern approach to solving crime. He had a very high IQ, may have a eidetic memory, He may also have Asperger's syndrome (even though the syndrome was not identified until the 1940s). He probably also has some forms of OCD. As well as a small drug habit.
According to this website:
(more on this website later)
Sherlock Holmes Son is Nero Wolfe, and a Detective in San Francisco named Spencer Holmes maybe the grandson of Sherlock Holmes (or Son of Nero Wolfe). This might be important when trying to figure out if Spencer Reid is related to Sherlock.

When we get right down to it, it's easy to see why Spencer Reid maybe related to Sherlock Holmes, all we have to do is look at his wiki entry and we see a very similar description to Sherlock.
Spencer Reid is a member of the FBI's BAU on the popular show Criminal Minds. - when he started with the BAU he was 22, and the youngest member of the team.  In fact he had to get special wavers to even join the FBI, let alone carry a weapon, and join the BAU.  He holds at least 3 B.A.s and a couple of Ph.D.s, he has also demonstrated some medical knowledge.  With the BAU, he helps puts serial kills and other really bad people away.
He has a genius level IQ, eidetic memory and Asperger's syndrome, as well as some tenancies to be OCD.  Sound like some one else we know?
Reid was raised in Las Vegas, Nevada by his mother Diana Reid. His father is William Reid, but left when Spencer was 10. Spencer on many different occasions has stated that Sherlock Holmes has influenced his life.

So clearly I can see how Sherlock Holmes was a major influence in creating Spencer Reid. But this is about how he maybe related to Sherlock, not just influenced by him. It may not be so easy to make a connection to the Lone Ranger or Green Hornet. The name is a give away for me however, it's hard to think those characters didn't have some influence on who Spencer is.

Remember the website above that I we'd get back to, the site that claims Nero Wolfe is Sherlock's son. That site makes some pretty interesting connections over many many different books, tv shows, series, movies. It's called "The Wold Newton Universe" and he can explain it much better than me. I'll attempt to hit the high lights thou of the "Universe".

"The Wold Newton Family is a group of heroic and villainous literary figures that science fiction author Philip José Farmer postulated belonged to the same genetic family. Some of these characters are adventurers, some are detectives, some explorers and scientists, some espionage agents, and some are evil geniuses." 
 "According to Mr. Farmer, the Wold Neton family originated when a radioactive meteor landed in Wold Newton, England, in the year 1795."
"The radiation caused a genetic mutation in those present, which endowed many of their descendants with extremely high intelligence and strength, as well as an exceptional capacity and drive to perform good, or, as the case may be, evil deeds."

The web goes on to list some of the people who are included in "The Wold Newton Universe".  Two names caught my eye, Lone Ranger (and by extension his family) and Sherlock Holmes (and by extension his family)

The website goes on to give some very detailed accounts of and reasoning for links between seemingly unrelated people.
But despite all of the work already done on this site, and even the Reid Family Tree they did, there is still no reason to think Spencer is related.

So, let's keep looking for some other clues that may not have been picked up on.
 Let's look at Spencer's parents. Diana and William Reid.
We assume Reid is Diana's married name, but what if (just what if) Her name was Reid when she married William Reid. While this doesn't happen often, it more common than people think. We really don't know much about Diane despite Spencer talking about her from time to time, and her help with some of the BAU cases.  We know she has a high IQ (genius level) even thou it has never been said what her IQ is. We know she raised Spencer pretty much as a single mother. We know that she has schizophrenia.  We know she was a teacher. We know she is still living in Las Vegas, at a sanatorium. We know she has a fear of flying. We also know that when Spencer was very young she witnesses the murder of Gary Michaels.
A few other things we know, Her favourite author is Margery Kempe and she use to smoke.
Unfortunately we don't know her age, but the actor that plays her is Jane Lynch, who was born in 1960 (making her at the time of this writing roughly 56). So we can make a couple of educated guesses here, and say that Diana Reid would be in her mid-50s, and very likely no older than 60.
We don't know and don't really have enough information to really guess.
But here is something interesting:
 From the Reid Family Tree (http://www.pjfarmer.com/secret/graphictrees/reidfamily1.gif), we do find a daughter of Britt Reid II and Ruth Hopkins who has a name of Diana Reid. The bad part the date listed she was born in 1947. That would make her 69 or 70 in 2016. And probably too old to be "our Diana Reid". It could be that the date on the Tree is wrong, And maybe it's should be 1957...That would make her 59/60 in 2016 - hmmmm it's on the high end of what I think Spencer's mother would be, but it is in the range of possibilities.

Let's see if we can find out any traits or habits that Brett Reid II daughter might have, if we can.
So I go back and see if I can find anything in the 1941 to 1970 section of "The Wold Newton Universe"
nothing is said about Diana Reid, but Brett Reid II took up the mantle of The Green Hornet in 1966. If my reasoning that the date is wrong, at the time her father took over Green Hornet she would have been 9. It seems very unlikely that a new father would go on dangerous missions in the underworld with such a young child at home.  However if the 1947 date is correct, she would have been 19, and most likely would have understood why he needed to do this.
It seems like a bust..... But I'll put yet another hypothetical in play - it appears little is know of 1947 Diana Reid - could it be possible that she had a daughter in the 1960s (1964/1965) - and named the daughter after her (?) That would make her daughter 52/53 in 2016, and She would have been 17 or 18 at the time of the birth - a hard life no doubt, but very modern. And with the Reid family money it wouldn't be that hard to image raising a strong very intelligent female.

Don't buy any of that - ok, let's look at Spencer's father - William Reid.
We don't know very much at all about William at all.
For the most part, He is an Attorney, He still lives in Las Vegas, his favourite author is Isaac Asimov, he likes cats, drives a Prius, still works at the same law firm (Kierschenbaum, Wieder, and Moore) He has also keep an eye on Spencer via news reports and electronic means.
We don't know his age either, but again, the actor that plays him was born in 1959. IF we base Williams age on that - it would make him 56/57 in 2016.

 That doesn't really help at all, on the Reid family tree that is no one even close to being named William. But wait, I'm not done digging into the "Spencer Reid" family.  (But here is were it's going to get weird again).

On Both Diana Reid's entry and William Reid's entry There are two people listed.
Daniel (brother (in-law); deceased) and Ethel (sister (in-law)) - The thing is they are listed the same way on both entry pages- and there is no more information about them (More digging is needed) Also no last names are given, I have to figure they are both Reid's on Spencer's page Daniel is listed as his UNCLE! and deceased....Do we finally have a solid connection to the Reid Family Line in "The Wold Newton Universe" I'm not sure, there is a Daniel Reid III listed as being born in 1983 on the family tree - It's listed that Daniel is still alive however, and would be roughly the same age as Spencer. Also thou, there are many Daniel's listed on the family tree, so based on the name alone it fits very well into "The Wold Newton Universe".

We don't know at this point (we may never know) - Spencer Reid's middle name, if he has a middle name.
It would make things very interesting if his full name was "Spencer Daniel Reid"
Not just in the fact that there is a Daniel Reid III listed with a very close birth year, and very close to the age. But it would almost certainly firmly cement him in the "Lone Ranger - Reid line"

I've said money a few times now so - let's think for a few minutes. Spencer effectually supports two houses, Himself, and his mother.
While it's true Spencer could count cards or had systems that got him banned from casinos, that isn't how he made his money. He's just too honest to do that.
He does work for the FBI we don't know what his pay grade is. Based on his age, he's been with the BAU 7 or 8 years - if we just guess he gets a pay raise every year that would make him a G3 step 7/8 or 31500/32252.  He may get additional pay for BAU, hazardous duty, etc. But let's face it he doesn't make a lot of money.
Where does money come from, how did he pay for school?  -the answer -  The Reid Family Money.

My prediction is sometime in the future it will be reviled that he had a great uncle who was a Texas Ranger.

Geographically there are some similarity as well - Nevada, and Texas, Brett Reid lived in New York, and Washington DC is a short train ride away. So while not prove, all the players are located in a very similar area.

Let's move on to Sherlock Holmes - I'm going to keep this one brief
and point to a few things I already touched on.
Sherlock had a son name Nero, Nero (possibly) has a son named Spencer Holmes.
Spencer Reid shares trades common with Sherlock Holmes, in most respects he is a modern interpretation of Holmes.
 Spencer's first name is Spencer - it wouldn't be too much of a stretch to name someone after someone in your family, even if distant cousins.
Despite these things hitting us in the face with each episode, I have found little to nothing to backup any idea that Spencer Reid maybe related to Sherlock.

It is much more likely that Sherlock did inspire the writers to create Spencer Reid, and that he is really related to Brett Reid/Daniel Reid/John Reid and is carrying on the "family" business of taking out the bad guys.

I didn't just base this idea off the name, there are some other things that make me believe it.  For instance Lone Ranger, Green Hornet and Spencer Reid all fight against crime syndicates.
Each has dawned a mask to help (or try) to save someone else.
The Lone Ranger was a Law Man (Texas Ranger) -
(Here is another IF) - IF Texas were not part of the United States, The Texas Rangers would serve very much in the same role as the FBI, and U.S. Marshals combined.
It is not any stretch of the imagination that a great grand nephew of the Lone Ranger would want to go into that type of work, but on a bigger scale (all of the U.S. not just Texas).

There are other little things
Like I think Gideon early on gave Reid a bullet. And think that bullet was silver - Reid carried the bullet with him for a period of time. (Time to rewatch the first few seasons)

Sunday, October 11, 2015

Intermediate Arduino Programming 101: Rename Hardware Serial Port

Intermediate Programming 101: Rename Hardware Serial Port

Why would we want to rename a hardware device - it makes the code easier to follow and edit.
It also helps when there are more than one hardware serial device, like on the Mega
code like this:

void setup() {
Serial.begin(9600); //debug
Serial1.begin(4800); //gps
Serial2.begin(9600); //compass

Turns into this:
#define Debug Serial
#define GPS Serial1
#define Compass Serial2

void setup() {

void loop() {
Debug.println(“This goes to Serial Console.”);
GPS.println(“Hi GPS…..GPS Doesn’t understand this”);
Compass.println(“Some stuff that compass doesn’t like”);

In this example we see something called #define, we all have seen this, may have even used it, or copied it from someone else's sketch, most don’t question what it is or what it does.
So - Here is what it is, and what it does:

#define is a useful C component that allows the programmer to give a name to a constant value before the program is compiled. Defined constants in arduino don't take up any program memory space on the chip. The compiler will replace references to these constants with the defined value at compile time.

You can #define your own constant as well example a LED pin.

#define RedLed 3

This makes things a little easier on the programmer, he/she doesn’t have to remember that the RedLed is connected to Pin 3 - or even better, you just have to change one thing should the RedLed move to Pin 4.

To the Arduino - (after the sketch is compiled and running on it) - it replaces all of the RedLed references to 3.

So in our Serial example above - at the time the sketch is compiled, the compiler sees this:

void setup() {

void loop() {
Serial.println(“This goes to Serial Console.”);
Serial1.println(“Hi GPS…..GPS Doesn’t understand this”);
Serial2.println(“Some stuff that compass doesn’t like”);

So this sounds great right? Now for the warning,

There can be some unwanted side effects from using this method.
if for example, a constant name that had been #defined is included in some other constant or variable name. In that case the text would be replaced by the #defined number (or text)
In general Arduino prefers using the const keyword (https://www.arduino.cc/en/Reference/Const) for defining constants.

So that is it in a nut shell. Quick and Easy way to rename hardware components.

Wednesday, October 7, 2015

Intermediate and Advanced Arduino Programming Concepts

Arduino Intermediate and Advanced Programming

Oct 7, 2015
At last weeks meeting, Frank brought up the fact that his BittyBot didn’t seem to go forward, or backward at the same rate of speed or time, and that the timing seemed off.
part of the reason for this is in the sketch he was talking about, DELAY was used for timings.
And I always knew DELAY is not what I wanted to use, but it’s quick, and good for testing.
what DELAY does is stop the microcontroller, it will not advance to the next step in the program until the DELAY is meet.
Frank’s questioning the timing last week was a good reason to go back and rewrite the DEMO code using a different method for timing. Once before we did a demo for Frank that had different timings and a button push for a LED. In that we used MILLIS() and watched the clock our.
The idea is to watch the clock ourself this lets the sketch advance and do more in the same amount of time.  
So let’s look at something simple (BLINK):

int LED = 13;
int State = 0;

void setup() {
pinMode(LED, OUTPUT);
digitalWrite(LED, State);

void loop() {
State = !State;
digitalWrite(LED, State);


Ok, pretty simple, but each time a DELAY is reached the sketch stops and waits, nothing else happens. - Let’s look at the same sketch but without a DELAY, using MILLIS()

int LED = 13;
int State = 0;
long previousMillis = 0; // this will store the last time the LED was updated
long interval = 1000; //this is the DELAY in milliseconds (just like using DELAY)

void setup() {
pinMode(LED, OUTPUT);
digitalWrite(LED, State);

void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;
    State = !State;
    digitalWrite(LED, State);

What is going on here for each loop of the sketch it checks how long the microcontroller has been on, minus the last time the LED was changed, it says that it needs to be greater than the DELAY time (1000) - changes the State of the LED (toggle), and updates the previousMillis.
It looks like a harder way to just blink a LED, but what it’s really shows is that if it hasn’t been at least the INTERVAL time, I can move on and do more code.
So if you wanted to also check a ultrasonic, or move a servo, or check the battery level, you could do all this while still blinking a LED.

Why do we need to know this well because it leads to a more advanced concept called Object Oriented programming.  In the above example, everything is still done inside the loop function. With OOP you set things called CLASSes, DATA, METHODs, and OBJECTs.
A Class is a group of Methods, a Method is a group of code that relates to DATA in the Class. A Object is the “friendly” name for a class (at least that is how I understand it)
We honestly uses these all the time, but most of us don’t know it. Libraries use Classes, this is something we don’t normally see, but we use.
The example I will use is SoftwareSerial (https://www.arduino.cc/en/Tutorial/SoftwareSerialExample)
when you invoke a instance of SoftwareSerial you are making a object that object talks to the SoftwareSerial CLASS.
IE: SoftwareSerial mySerial(RX,TX);
mySerial is the “friendly” name we are using, it can be anything we want - serial2, camera, or whatever.
SoftwareSerial camera(RX,TX); - in some cases just a general object like mySerial is good, and in others it’s nice to know which/or what you are talking to  camera.
Generally you’ll see a comment telling what the object is talking to, so someone can follow what you are doing in your sketch. Sometimes it’s clear and others not so much.
We can create more than one SoftwareSerial object - IE:
SoftwareSerial Serial1(RX1, TX1);
SoftwareSerial Serial2(RX2, TX2);

In this case each object has it’s own set of DATA it can use, IE: it could be 2 different baud rates, or whatever. And the two instances shouldn’t affect the other.
With the SoftwareSerial library, we have a few different methods.
etc….. Each method in the library is a function that interacts with the SoftwareSerial Class.

What is inside the () for each method call could contain DATA or not.  
The library also uses what is called PRIVATE DATA, this is really more advanced than we need to know right now, but for the most part this is DATA that only the class needs to know, Settings, timing checks, etc.  As a rule we don’t have access to this DATA and only the CLASS can change it.

A library is more advanced that most of us program, someone else has already figured out what needs to be done to make sensors work, or just what timings need changed to add additional PWM or change the PWM, or whatever. They are nice, because it makes life easy, we want to use a I2C device, we include the Wire library, we want to send information over a 433Mhz link, we use the VirtualWire Library. We don’t need to know anything else.

So that is the very basic overview of a library.  Why is it important, well, as I said, we use Object oriented programming now, we just don’t know it.
We can make our own Libraries -

And what isn’t clear is we can make our own CLASSes, They work very much like how we use libraries now, the biggest different is they are contained in the .INO file.  
At one time I read they needed to be at the top of the file, before you declare your variables and include other libraries, I can’t find that now, but I think it’s true.

So, I’m not going to go into too much about some of the Intermediate and Advanced Programming features for the Arduino.  There are literally hundreds of good tutorials on line that can explain some of this much better than I can. But here are some basics Arduino is programmed in C++, C++ is a object orientated programming language.

So what does that mean really?
From Wikipedia:
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which are data structures that contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. A distinguishing feature of objects is that an object's procedures can access and often modify the data fields of the object with which they are associated (objects have a notion of "this" or "self"). In OO programming, computer programs are designed by making them out of objects that interact with one another.[1][2] There is significant diversity in object-oriented programming, but most popular languages are class-based, meaning that objects are instances of classes, which typically also determines their type.
Many of the most widely used programming languages are multi-paradigm programming languages that support object-oriented programming to a greater or lesser degree, typically in combination with imperative, procedural programming. Significant object-oriented languages include Python, C++, Objective-C, Smalltalk, Delphi, Java, Swift, C#, Perl, Ruby and PHP.

Well that clears it up doesn’t it -
What it really means is you have a group of things that are all related to each other. (DATA)
It also has something called “Members” this is what to do with the DATA.
When both of these things are together they go into a CLASS.

So if we look something like the BLINK without DELAY sketch again:

int LED = 13;
int State = 0;
long previousMillis = 0; // this will store the last time the LED was updated
long interval = 1000; //this is the DELAY in milliseconds (just like using DELAY)

void setup() {
pinMode(LED, OUTPUT);
digitalWrite(LED, State);

void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;
    State = !State;
    digitalWrite(LED, State);

We can make this a CLASS:

Class Blink {
    int LED;
    long interval;
    int State;
    unsigned long previousMillis;
//This is the constructor - and it initializes the members and variables and states
Blink(int pin, long on) {
    LED = pin;
    pinMode(LED, OUTPUT);
    digitalWrite(LED, LOW);
    interval = on;
    State = 0;   
    previousMillis = 0;

void Update() {
    unsigned long currentMillis = millis();
    if (currentMillis - previousMillis > onTime) {
    previousMillis = currentMillis;
    State = !State;
    digitalWrite(LED, State);

Blink led1(12, 1000); //Create a object called led1 attached to Pin 12, with a delay of 1000
Blink led2(13, 1200);//Create a object called led2 attached to Pin 13 with a delay of 1200

void setup() {

void loop() {

So as you can see, the class looks very much like the Blink with out Delay sketch, with a couple of notable exceptions.
There is now something called PUBLIC in this:  This is were the functions we have access to will go.  In this case, we have the constructor (Blink, and the Update function)
In the case of SoftwareSerial some of the PUBLIC functions were already listed.
There is also a PRIVATE constructor, this is a place that only the CLASS has access to. We don’t need any PRIVATE things for this CLASS.

In the above example, just like with SoftwareSerial, we call the Blink class and create a object called led1 and led2, these objects both have 2 variables to them.
and like SoftwareSerial, we use the “friendly” object names to interact with Blink class.

The loop in this example can run very quickly and the class keeps track of both states of LEDs, and the timings used.

What will this do for the BittyBot - well, I re-wrote the drive  sketch, (which showed how to make the Bitty move) into a CLASS, This allows additional code to be ran, while still watching how long the motors are on. I demoed this with a re-write of the Ultrasonic code - If you remember the 1st ultrasonic code would sometimes run into things, the code worked for the most part, but still would at times hit things.  Using the CLASS (which uses MILLIS) and better timings, the ultrasonic rarely hits anything now, it still not perfect, but is much better.
Also using the class I wrote a sketch that can use a Joystick to remotely control the BittyBot.
(actually, there are a few intermediate/advanced programming things beyond the CLASS in those sketches as well)

I plan on doing a re-write of the ESP8266 sketches using the CLASS, while the DELAY for the one sketch didn’t seem too bad, I think it will improve with using CLASS.

HERE are a few (like I said there are hundreds of tutorials) tutorials I found for CLASS, and CLASS with Arduino:

https://learn.adafruit.com/multi-tasking-the-arduino-part-1/overview (This is the one I used to base my code on, and my example above, it’s not the same as what I did above, but it is what I based it on)

SO CLASS is a fairly advanced  programming concept, but there are even more ADVANCED concepts that the Arduino can do, and you can improve your code greatly if you understand how you can use the timers built into the Arduino for yourself.
It should be noted that making changes to some of these timers can really mess things up too.
Here is a sites I found that explains some of what can be done with timers:
http://gammon.com.au/interrupts (I got more from this site than the one above)

There are other sites that explain it too, most of this is over my head. But it’s a worthy exercise to learn.

Also in the MORE Advanced category:
Using PIN Change Interrupts.  So  we know the Arduino UNO has 2 interrupt pins, that are documented, and easy to use.  However, All of the PINs can be used as CHANGE interrupts.
They are 3 BANKS of pins that can be used, and the trick is be able to figure out which pin in the BANK triggered the interrupt.

A lot of the advance concepts fall not only in the hardware realm, but also in just how powerful C++ is.

Original Document