Programming Throwdown - Arduino
Episode Date: March 5, 2018Ever want to build your own robot? We explain how to do this using Arduino! Show notes: http://www.programmingthrowdown.com/2018/03/episode-75-arduino.html ★ Support this podcast on Patr...eon ★
Transcript
Discussion (0)
programming throwdown episode 75 arduino take it away patrick welcome back to a non-interview
programming throwdown.
That's right.
I really like the interview episodes.
I always like talking to people.
Well, I just like talking.
I like talking to people.
But, you know, sometimes I was sitting down and, you know, picking my book of the show and my program show.
I'm like, I kind of miss doing this.
Like, I've been too long without being able to talk about something I've read.
So, actually, I like a lot. I had a lot of books and I had to I actually did too yeah I mean I um I don't know
if I mentioned this in the past episode but um audible uh you know I uh uh they reach out to me
in like Christmas and I don't know if you got the same thing I did but they said you could pre-pay
for the year and it was significantly cheaper.
Yeah, almost like half price or something.
Yeah, that's right.
It was half price and I got all 12 credits up front.
And yeah, I jumped on that.
And yeah, and so I've been reading a ton of books.
I picked one of them for Book of the Show.
But yeah, we definitely have a backlog.
Yes, I also did.
Oh no, I did it a while before that so
i've actually had the 12 credits for a while but then you still get the access this is anyways
this is off topic and you get the access to the sales for the thing and i my commute is just long
enough that like i i just really enjoy listening to the books and i really make to make it through
them quite quickly um and so i have sort of a large catalog.
But the 12 credits, like one per month, isn't really sufficient.
So then they have sales where they run stuff for, you know, $2 or $5 or buy one, get one free.
Oh, nice.
Or something.
And so they'll email you like, oh, there's a sale going on.
And I end up almost always picking up like a book or two from the sales just to supplement the fact of uh you know having
enough to listen to nice very so all right but the first topic i want to talk about is something
that i've actually talked with people about work about when we interview people at work
this is a discussion that comes out and so i thought it'd be interesting to to sort of discuss
it here what you have to say i have some thoughts on it i guess um and then generally you know there
won't be an authoritative answer here but at least if people in the audience have this question
though i've heard it and that is should programmers be expected to code in their free time uh and i
slightly changed it to working programmers because i think a lot of people listening
uh who are students are not paid to program or doing a different job
and doing programming on the side only do programming in their free time.
But if your job is a software engineer or that you're being paid to do programming,
is it an expectation that you should have a project on the side
or something where you regularly do code outside of work
to show your passion for programming? So I'll let you go first, Jason. So I teed it up for you, and let's see where you regularly do code outside of work to show your passion for programming.
So I'll let you go first, Jason.
So I teed it up for you, and let's see where you drive the boat.
All right. It's a tough question.
So, okay, here's what I'll say just as a preface to this.
I think that, you know, your job is kind of a gradient, right?
So, in other words, you kind of get what you put in in and hopefully, you know, obviously it's not an absolute, but in general, you get what you put in.
And there isn't really like this binary, you know, like, OK, you cross the threshold type thing.
So, I mean, I would say, you know, if people are doing some work on the side, That's part of kind of building your brand.
And so I feel like it's going to help you
in the same way as there's tons of things
that could help you.
If you do, I don't know, speech coaching,
it could help you, you know.
But when you say the word expected,
anytime you use words like expected, it's kind of, it's breaking down like that view I have of work where it's sort of this bank account and you contribute more or less and you get returns.
And it's turning it into more like, you know, what's the bare minimum I have to do?
You know, like there's basically two paths in life
and how do I make sure I'm on the right path? And so, you know, I have kind of an issue with,
I guess, the whole premise of the question. So I would say, you know, no, I mean, you shouldn't
really be expected to do anything. But it's also, I think it would help almost anybody.
And so, you know, I guess the question is, do you want to get more out of your career? And then the second question is, you know, based on what you're doing now, is this the best, you know, bang for your buck?
In terms of like, you know, from what you're not already doing to better your career, is this the next best thing?
And I would say actually, yeah, I mean, the thing about this that's nice is typically
it's some project that's not, I mean, certainly it's not related to your work.
That's why you're allowed to do it in your free time.
You get full credit for it.
You know, it's much more resume building than the code at work,
which you generally can't share. So yeah, I mean, I don't think anyone should be expected to do this,
but I would say this would probably be on my top 10 list of things to do to, you know,
make your career go further. That's my two cents. So before I i say my piece i'll say it a different way would you
with not knowing anything else about a person's resume or let's say we have we did a you know
a study where we gave you two resumes that happened to be identical except one of them
had work that they did on the side uh you know in their free time or pointed to a github repo
where they had some
projects that they worked on actively, not not like in the past, but they're actively working
on projects, like how much more weight would you give that over the person who didn't have
something all else being equal? Yeah, I mean, probably a lot, personally. I mean, again,
I mean, if that if, if, if all else is equal, yeah, I mean, if that if if if all else is equal.
Yeah. I mean, I would consider somebody who.
So so there's two parts of it.
One part is if if the person has these side projects and they're actually popular, that there's a variety of skills that that make that happen.
Right. I mean, if someone just took tutorials off the internet
and implemented them, and all of their projects
have zero stars, and it was just like an academic exercise,
that's kind of different.
But if someone has some projects that they built
and they actually have a following,
yeah, I mean, I would say that's pretty significant, yeah.
Okay, so I think this is a difference
because actually you and I differ on this.
So you do do programming outside of work and I almost do no programming outside of work.
And so I'll bias the other way, which is I actually, you are right, of course, with almost everything you're safe in saying it depends.
Yeah, of course. So if you have, you know, a popular like, wow, this is a true almost equal to a job level of project that you maintain. Right. Where I might interview you, even if you weren't a programmer, even if you weren't working at category almost um but if you're just a person
who has even a mildly popular or not at all popular mildly popular i guess is ambiguous
if you have something that i hadn't heard of uh or that a quick google search doesn't reveal to me
is like a very commonly used piece of software like how many stars like maybe your project has
you know less than 100 stars or something yeah Then I basically don't count that at all.
It's not even interesting to me.
In fact, when people put their...
And this is going to differ,
which is why it's good that we're both presenting our opinions.
Sure.
But I almost never go to people's GitHub pages on their resumes.
I'm just not interested.
Oh, yes. I'm totally the opposite.
But I think to your point point if it doesn't have
a fall like i don't know i mean i don't want to put a star number on it because it's much more
like abstract than that people are going to be buying stars yeah but if it if it doesn't have
like if there's never been a pull request you're the only committer it has three stars then it's
it's the same as nothing um but no i mean i look and if it has some pull requests and there's some discussion and
the person is making some decisions,
um,
but I can,
I can suss out that.
Oops,
sorry.
Good.
Oh no.
I was gonna say,
especially if there's,
if it's big enough where you have sort of conflicting interests type thing,
or you have to do some type of organizational work.
Um,
and again,
this is all things being equal.
Here's one thing I will say just to
finish my part is, is if I don't have that information, so let's say there's somebody who
does, does nothing outside of work. Well, then I would spend more time in the interview.
You know, I wouldn't really talk about their non-existent GitHub, but I would be spending
that time talking to them about work situations and, and,
uh,
you know,
presumably they would,
they would,
uh,
they would be able to fill in there.
Yeah.
That's what I was going to say is,
is basically that,
which is I'm going to ask about that anyways,
to understand how does this person deal with conflicting interests?
How do they manage their time?
What are the kinds of things they like to do?
So I'm going to ask those anyways.
And as far as like the expectation, I mean, I think there is a belief, at least some blogs and whatever will say that, you know, oh, basically you it's an expectation.
If you're not passionate enough about programming to do it with like all your spare time, then like that's not the kind of person they're interested in hiring.
And those people do exist.
I mean, I'm not going to counter it, but I personally don't. I don't think that's not the kind of person they're interested in hiring. And those people do exist. I mean, I'm not going to counter it.
But I personally don't think that's true at all.
I don't hold it as a – it is definitely not a negative at all for me
if you don't have any external to your work projects.
But that isn't to say – and I think Jason alluded to this in the beginning,
although he might have said it slightly stronger than I did,
which is if you do have something, it can be a benefit. Um, if for nothing else than for teaching you
what it is, you're not getting from work. And I think this is the difference is if you are
currently, you know, and I'm just, and I'm not saying good or bad, I'm just going to pick
something like if you're currently doing, you know, website, JavaScript, front end stuff,
and you want to get into distributed data processing. But at work, you're literally
just slammed with, you know, layout of, you know, the website, and you're not getting the
education you need, it's going to be very difficult oftentimes to convince a team or a company to hire you for work in something you
haven't proven yourself in doing external projects even if they aren't popular even if they don't go
read your github will teach you the expertise you need to be able to talk confidently at least at
some level in an interview now you should still be honest that hey i've never you know i only done
this in my spare time or only you know examples, examples. I've never done this at my company. Like you should never be deceitful there,
but you can still express a confidence that you understand what it is to do, you know,
distributed data processing or whatever. And I think in those ways, it is sometimes necessary
as part of resume building or part of learning to do extracurricular programming yeah i guess the
question is like i mean if we were to come up with a list of you know someone comes to you and they
say i want to uh you know improve my career you know i'm software engineer i want to be software
engineer level n plus one or something like that like how would you prioritize you know
coding in your spare time versus other things like like you know what would be sort of your advice
uh that would be better than this right i mean yeah it's difficult because i mean i think there
are things you can do for instance i don't think it has to be I think it could be reading like reading about how you know other people do stuff reading you
know it sounds like goofy but you know that makes sense reddit programming or hacker news
um you know reading books like you know uh coding complete or whatever you know something about
how to negotiate a promotion sure something like that. Or even, you know, not necessarily having a project in functional programming,
but just trying to make it through a functional programming book.
I think those kinds of things can also help.
It doesn't have to be actual programming and debugging
and building a project to completion.
Yeah, that makes sense.
I mean, one thing we can both agree on is that if someone doesn't,
if someone has an empty GitHub and they say they do no programming outside of work, that's not a disqualifier. I mean, that's, I maybe just so one of the things there are jobs where, and I don't do to kind of mess this up, but I've seen jobs where somebody hands you a picture of an app like that they drew in Photoshop and they just say, look, I want the app to look like this.
And and for those kind of jobs, they're really interested in kind of throughput.
Right. And so if you're getting a job where like
throughput is the most important thing like lines of code per hour worked or something like that
then maybe someone could say oh you know i'm paying everyone's salary this person who does
all this stuff on the side maybe i could get them to do a hundred hours of work a week because
you know they have more energy,
but those are not the jobs you want. Right. So, so in other words, the jobs where they would expect
their programmers to work in their free time are probably not the jobs that, that you want. So,
so I wouldn't, I wouldn't put this demand on yourself if you're a developer.
Well, that was, that was something i was going to say though for me
i try to get jobs interview change teams move within a company whatever is necessary to try
to get a job where i get sounds bad but get like the fulfillment i need about programming at work
so yeah if i'm like hey if i'm really interested in embedded programming then like i'm going to
join a team that's trying to do low level programming or way like how much i care about that because i want to be doing the thing at work that i'm really passionate
about and that sort of get that fulfillment and then when i get home i don't need to i don't feel
like oh i'm not doing the kind of work i'm interested in yeah i mean that's that's another
issue where we differ like if i had that mentality, I would be quitting every three months.
I would be changing jobs.
But that just comes down to we have different natures around that. But yeah, I think it's a really interesting question.
And I think it's very hard to have a good answer.
The one thing I would say is definitely don't put pressure on yourself if you don't don't code in your free time i don't think
that this is should be some kind of mandate or something and and for what it's worth i do try
to convince people who have this attitude that like there should be extracurricular work i do
try to convince them that this is not necessarily true because i mean there's also very personal
reasons why it just might not be a good time for you to be doing things right you know if you just and and it's not always you're not bringing up as an excuse
but maybe you in your life recently struggled financially and had to work a second non-technical
job or you know you you're uh had a child or you had a illness in your family you need to take care
of maybe you yourself were ill um all of these things could be reasons why the person for a year or two or three years hasn't done this kind of stuff. Yeah. And on the flip
side, there could be someone who's done a lot of stuff in the free time because they are just not
doing well in their job. And so you're kind of rewarding a bad situation there. Right. So
yeah, I think with anything, there's there's a lot of ingredients that go into whether you're
hiring whether you're trying to improve your own career and this is like this is one of them but
yeah anytime you see this like expectation that's probably a red flag you know well on to news and
links my first one is uh a game programming tutorial using Lua.
And I'm going to say it, Love, but if that's wrong, I'm sorry.
No, it's Love.
You're right.
Okay.
I've actually used this before.
It's a pretty good library.
Oh, okay.
So Lua is a scripting language, and Love is a framework for making 2D games in Lua.
And there's a couple of interesting things about this so the the links
in the show notes but the game being made is called bite path um and it's a it's it's probably
interesting because the tutorial takes place in a series of github issues so the person made github
issues that describe all of the parts of the tutorial it's also interesting because lua
has been one of those things that like oh i don't even know for how many years has been on my like
list of i should really get you know get acquainted with this and working with it um and i've always
wanted to do some sort of like simple or retro style 2d game in my like giant list of things i never get to uh same here one
day i'll you know retire but i'll actually just be super busy in retirement because i have to get
through all this stuff i never did um and this is like one of those anyways it really struck a
bone for me it's like oh i i want to go do this and just talking about programming in our spare
time and the fact that i don't do any of it means i didn't unfortunately follow this tutorial um But if you didn't see it when it was like kind of making the rounds, check it out.
So you've used Love before?
Just I ran some demos.
I made a very simple thing with it and it looked pretty cool.
Yeah.
Have you done much with Lua before?
I have a long time ago.
I actually wrote part of this thing called Diluculum, which you can look it up.
I don't know if it even exists anymore.
But it was basically a Lua C++ binding API.
And you could access C++ objects in Lua and vice versa.
And it's kind of like the Python API, like the boost Python type thing,
but for Lua.
Okay.
So I was really into Lua.
This was, gosh, a long time ago.
This was over 10 years ago.
But yeah, honestly,
as soon as I really found out about Python,
like I'd heard about Python,
but as soon as I really got into Python,
which was, yeah, as I said,
about 10 years ago, Lua just died
immediately for me.
The Python
C API is not as nice. It's harder
to embed Python. But
that kind of just slight
mechanical challenge
is not worth
using any other scripting language
or interpreter language. So I've been
pretty heavy into Python.
But I did think Lua was good when I was using it.
Nice.
So my news is it's actually a YouTube channel
that I've been following for a while,
but I hadn't really talked about.
It's pretty cool.
It's called Charisma on Command.
It's very popular.
A lot of people listening to the show have probably seen it before.
They had one that was really cool.
It was how to make any story interesting.
And in the past, I've always kind of felt like, I don't know, I've always had sort of a, what's the word?
Like I'm giving kind of side eyes to people who, who like over emotionalize
things, you know, like when they're talking, they have too much inflection and things like that.
It's always kind of a big turnoff. Right. And I think it's still true. I mean, if you
just overemphasize everything, people, you know, get kind of turned off, but,
but this basically argues the opposite. It says, you know, part of it because you kind of know what you're going to say and you should watch a video, it goes into a variety to think before you talk in most settings. Most of us are doing that. And so you've already thought it through. You've already kind of played
it out in your mind. And so now you're just reliving that, that, you know, you're just
living out that prediction. And so just naturally when you talk, you're not, you're not using as much inflection as you want.
And so it talks about that, a bunch of other things,
but it really goes into detail on, you know, instead of just,
because you see a lot of these things where it's like, you know,
three interesting things you can say, and it's all about the content
and how to strike up a conversation.
They usually look so focused on content.
This is just, you know, you can't control the content.
Like you're going to say X.
How do you make X interesting?
And I thought it was pretty cool.
And so in general, this Charisma on Command is amazing.
I've been following it for a while.
The videos are really useful, really interesting.
But I thought this one really kind of struck a chord
because it was not only interesting, but it was also something that one really kind of struck a chord because it was not only
interesting, but it's also something that I was kind of against. And then when I watched the video,
it completely changed my mind. So I haven't really taken it into practice. I don't feel like I'm
speaking more emphatically than I usually do, but I feel like it makes, you know, it's plausible now.
Like it's something I would want to do.
And so kind of mulling it over,
but I thought it was
a fascinating video.
I feel like I kind of,
I don't know,
I've never seen this video.
I'm going to go watch this.
This sounds intriguing.
Yeah, you should check out
a lot of,
if you don't follow this guy,
definitely go through
some of his library.
Maybe watch the top five most popular videos from him or something.
But it's really, really interesting.
Interesting.
I didn't realize that people would have like a bias against that though.
I guess that makes sense.
Well, yeah.
I mean, there are those people you kind of tell, you know, when somebody just really overemphasizes everything.
Well, I guess it's kind of, you know, I always kind of picture when someone overemphasizes right off the bat.
I kind of just in my head, I imagine that this person just hasn't been through a hard life.
I mean, it's like not quite the right way to say it, but it's like if if if you know the first sentence is super dramatic
i'm just going to assume that it's not going to be that interesting but is but i guess there's
okay i need to watch the video but i guess there's a difference between sensationalism or like just
over embellishing everything or going into other details and making something motivating or you
know interesting yeah that's true too yeah and they talk about they
talk about kind of both of that because it sounds like what you're saying is like you don't like
people who open with just this like i had the worst day ever i found a single split end on one
of my hairs and you're just like oh okay yeah and so the thing to be aware of is apparently when
when you talk kind of normally completely unrehearsed you're doing
the opposite of that and so by adding some more emphasis you're really fixing just an inherent
problem in the way human beings kind of think and speak on the fly and so um at least you know
according to this video video um you know you want to overemphasize a
little bit to cancel out the like natural tendency to underemphasize but wait but if everyone knows
that people typically underemphasize then they've already beefed it back up in their heads so if you
go around doing this you're really just like exploiting people like you're just like wow
that person just has more interesting stuff happen to them all the time yeah i mean there's a question about in general
like is charisma and persuasion like are these things exploitive um i mean maybe yeah i don't
know but uh it's it's good to know either way it's sort of like uh um if you know let's say
you know how to i don know, choke somebody or something,
right?
I mean, knowing that is probably useful, maybe extremely rarely, but it doesn't mean you
have to go around choking everybody.
Um, but, but having that skill is more useful than not having it, I suppose.
Well, maybe you're persuading me to no okay yeah everyone's watching it right now that's just
such a such a i'm such a savant that's why our listener count is dropping yeah exactly by the
second the next article i have is who killed the junior developer uh this is a article written on medium by uh by a lady named melissa
and she is saying that you know that a lot of if you look at job requests that people have and you
know postings out there and it seems a lot of people are looking for senior engineers and i
always say i too would like a unicorn because people ask for
you know i want someone with 10 years of experience in node.js and it's like wait
node.js hasn't even been out 10 years or like right maybe it has no i guess it hasn't um and
just say stuff like that or i would like someone with five years of experience and embedded
programming and 10 years of ai experience and six years of computer vision experience. And it's like,
no way, like this person would have to, like, there's just, that's not a thing.
Um, but I think it goes a little further into just people don't want to hire. So there's that
aspect, which isn't exactly what, what, what she's talking about. But instead, um, she talks a lot
about, you know, how companies want what they call sort of senior engineer, which there's a lot of debate about what senior engineer is.
But they want someone who can hit the ground running, who doesn't have to be mentored or tutored.
Like they basically know how to get their job done.
They're like they are craftsmen at the job of computer programming.
And how that, you know, she feels that and she brings into there some issues maybe with, you know, how women versus men in the
workplace handle the mentoring role or the mentee role. And I think that's interesting. But this
fact of, you know, companies want to hire senior engineers because they don't want to pay to train
someone. They want to have someone who can come in and just start working right away. And not only
do they not want to train someone, it's not just that they have to, you know, wait for the junior developer to get as efficient as a senior developer.
But they also typically have to spend senior developer engineers times, you know, bringing up junior developers.
And the skill set of being a really good teacher or mentor isn't necessarily the same skill set as exactly what you need to get your job done. And that's not a, you know,
revelationary thing that, you know, oh, there's a good solution here. But just kind of pointing
out something that I've observed. So I sort of bring it up here, which is we kind of see this,
or I see this happen quite often where, yeah, let's hire a senior person. I've been pushing
on our team a lot for, you know, let's look at more junior people because, you know, there are a lot of really talented junior people
out there who are just looking for an opportunity. And, you know, part of the interview process is
making sure that you have the right opportunity for them. But I also believe that taking a junior
engineer and helping them sort of grow into that senior engineer thing on your team
helps them be really productive and really good at their role. And also, you know, a very good fit
for coming up in the culture and the situation and the team. If you bring in a senior person,
in some ways it's good because they're bringing a lot of experiences, but they're bringing on
a certain amount of inertia and almost you want to say baggage or whatever they're bringing a direction that they're
used to heading and that they think things ought to be done and sometimes that's good but if you
have enough of those on your team adding more voices often can slow us down a little bit as you
quibble more and re-digging up the why does your team use four spaces instead of two spaces for indentation or
not tabs right because this person is going to bring in maybe rightfully so as a senior engineer
they come in and they start to question things but that's not always what you want yeah i think
this article is super interesting i like that point where you know looking at it at a per hour
basis like we've talked about this in the past but you have you know certain times where you know looking at it at a per hour basis like we've talked about this in the past but
you have you know certain times where you're kind of in the zone and you have other times where you
just can't really be you can't be in the zone eight hours a day just banging out code i mean
almost nobody can do that and so you are either going to spend that time on you know twitter or
you're going to spend that time mentoring a junior engineer? So I feel
like, uh, the idea of saying, Oh, you know, it's taking away time and money from the company.
I don't know if that really, that really holds water. No, but I, I mean, I think it is something,
and we were talking about this unrelatedly before the show, but I mean, I think it is one of those
things where you have to be careful about what the, how to do well at your job.
And if your company doesn't sort of see mentoring as something good,
which is very rare.
I feel that even if companies don't have an explicit mentoring program
or a concept of that or bringing a new person up to speed,
that I've almost always found by being a person who helps the new people
and teaches them like has worked out well for me. Um, it has been something that my managers end up
respecting that, uh, you know, their managers end up, you know, realizing, and that the people on
your team sort of know how you, that's an easier thing to deal with because you, you sort of taught them your view
of what the team culture is and how the code review process works. So it's sort of someone who
ends up being in my mind, almost more compatible with you, uh, going forward and having a good
working relationship. So I've never had an issue where I felt like mentoring someone was, you know,
wasting time. Yeah, definitely. I mean, even in, you know, Silicon Valley where, you know wasting time yeah definitely i mean even in you know silicon valley where
you know the average person only stays was it two and a half years or something at one job
yeah even then it's still valuable so i mean if you're at a company where the tenure
is is longer than that then it gets it gets even more valuable right
yeah and and i've always appreciated when people senior to me you know
take time to to mentor me and to help um i kind of wish it happened more i really wish there was
more of a culture of you know teaching and learning but yeah i think it's difficult it's
difficult any company to really pull that off you have to have sort of really good inter-company
communication and and the thing is
it's not just having that communication but it's preventing a few people from kind of monopolizing
it one of the things i've learned not to go on too much of a tangent is you want to have like
really specialized channels of communication like we set up a machine learning noobs forum and that
works really really well and so you might ask yourself well we had a you know we had an engineering of communication. Like we set up a machine learning noobs forum and that worked really,
really well. And so you might ask yourself, well, we had a, you know, we had an engineering noobs
forum and noobs for people who don't know is like for newbies or new people. But in our case,
it was literally just, you ask a question about machine learning. Like you didn't have to be
brand new to machine learning or anything. And, you know, we had engineering noobs.
So the question is like well
why didn't that just vacuum all the questions away from machine learning noobs right and the reality
is you know there's a a few people or a few types of questions that kind of just dominated that
forum right and then when you get even more broad to like you know a forum with everybody who's in this office in a city or something then
it's just a couple of things will monopolize almost any forum regardless of the size and uh
um and so you know getting the right channel i think will help the the mentor thing a lot but
it's it's not it's not trivial to get right.
All right.
The last news item is Detectron, which is pretty cool. So I shared a news a few months back of a GitHub repository that came with a nice tutorial for training like a mask RCNN network.
And so the idea is like you give it some images and it would train and it would be
able to find the items on the page and stuff like that. This is similar. The cool thing about this
is they already have some models already trained. So if what you're looking for, if you want to
build a robot or something else that can kind of find things in images. As long as those things are from
the set and you can search through the set of categories, I think there's something
like a million categories, then you could just use one of these off-the-shelf
models. You don't have to train it or anything. So if you wanted to write
something to detect, you know, dogs versus hot dogs or something like that um you could just
use this off the shelf and uh it would just work i mean it would also tell you other things but you
could just throw those away um but it would tell you you know where the dogs are and stuff like
that um so it's pretty cool if you need to do any kind of image processing if you want to build your
own like paintball gun turret or something crazy um check
out this detector on the screen it's time for book of the show it is book of the show it's been so
long we're so excited it's we're reuniting um my book this show is basic economics by thomas soul and uh you know i talked again a few months
back about um you know i tried to build this economics type simulator and and uh um you know
i was using some pretty sophisticated machine learning but i just couldn't really get it to work
and it turns out after reading this book i know nothing about economics. Or at least, you know, I thought I knew stuff about economics and I really didn't.
This book is, I think it's like pretty standard reading for if you're in economics, like, you know, undergraduate or something like that.
The cool thing is, and it even talks about this in the very first, like, preamble of the book.
The very first sentence is, you know, you're not going to find any graphs.
You're not going to find any equations.
This is just about the principles of economics.
It's written in very lay terms, so you don't have to be an economist or anything like that.
It's really fascinating.
It has some really in-depth case studies on planned economies so
for people who know that's where the government or or someone sets the prices um so in a sense uh
um like uh garbage or maybe not garbage but uh like like minimum wage jobs are a sense of planned
economy all right so if you work a job that's a minimum wage job, the government, as they change the minimum
wage, they're changing how much money you're making.
That's a planned economy.
Unless there's a massive shortage of your job, and then it's not minimum wage anymore.
But it talks all about these different planned economies, both like massive, large scale planned economies that they had kind of decades ago in India and the Soviet Union, things like that.
But also, you know, like local, you know, microeconomic sense, like local planned economies and basically like why they're all bad.
So the book definitely has a slant towards, you know, pure laissez-faire free market economics.
But, you know, you obviously have to take that into account while you're reading it.
But it talks all about these different economies.
And it really explained things that I just didn't really understand.
You know, I was like, how does this thing cost so much?
Why does this cost so little?
Why is this happening?
Why is that happening?
It really kind of, it covers a lot of really interesting topical cases.
And these are just core things that as a society, we get wrong over and over again.
And it even talks about why we keep getting them wrong.
It has to do with, you know, it's just easy to convince a lot of people to do the wrong thing and they'll love you for it.
But it covers a lot of different scenarios.
It's really, really interesting.
Just to explain, like, the simulation that I had, you know, it didn't work for two reasons.
One, actually, part of it was working. I
didn't realize there's going to be some agents who are just going to fail. So, so part of having
a good economy is that there needs to be sort of businesses that fail and businesses that succeed.
And there has to be sort of some risk. And the consequence of the risk is, you know, you go
bankrupt. Um, if no one's going bankrupt,
the economy is not really working. It means people can't really take any chances.
And the other part of it is there needs to be a whole network of alternatives.
So in my case, there were several businesses, but they're all doing the same thing in my little
simulation. And so people couldn't say, oh, the price of bread went up,
I'm going to buy carrots instead.
And so without alternatives,
the economic system doesn't really make any sense.
And there's, I mean, I could talk for a whole hour.
There's a whole bunch going on here,
but you don't need to have
a super strong background in economics.
Definitely read it if these are things that are interesting.
And it's a pretty long book. i haven't got through it all but even if you just read the first couple of chapters
it would be worth it economics is always one of those things where i think a lot of people
underestimate um how how good it is as explaining a lot of stuff that happens.
But then there are sometimes people who overestimate, you know, what economic theories can predict.
And so it's one of those really, I've only ever studied economics at a very small level.
And so there's a lot of things like you're explaining.
These actually seem very fascinating.
But then at some point, it's always difficult to map back.
Like, you know, like you said, oh, every time there's been a planned economy, it's failed.
It's like, but, you know, such statements always seem like, you know, very difficult to make.
Absolutely.
Yeah, you're totally right you know what i mean i yeah
it feels like one of those you know they say you know this science of economics i don't know if
you would call it a science or not but just like the study of economics always seems a little hard
for me because it wants to make these absolutes but you really can't because it's all about at
some level all about humans and it's very difficult to make absolute statements about human behavior yeah and even if you did you know there's there's sort of a heisenberg principle
here right like if you tell everyone look x is bad then everyone will stop doing x but then that
will change the whole dynamics of the whole system like by virtue of everyone not doing x maybe x
becomes good you know so so there's all sorts of
weirdness going on you need game theory too so you got to be a economics expert and game theory
and yeah i mean it's all kind of tied together yeah um yeah so i would say you know the book
this person has a lot of strong opinions you know i i definitely don't agree with all of it
but i learned a incredible amount so has it changed what you're going to vote for
in the next election no it's okay no i'm just oh i have no idea um i could tell you that uh rent
control doesn't work um that has been proven and they actually they just uh passed rent control
in mountain view which is a city right next to where we live um and uh this book talks all about all
the places in the u.s that have passed rent control and explicitly like what happens and
it just doesn't work and it's not one of those things where it can't work or it just hasn't worked
i think um i think i would say that it can't work.
Basically, I'll tell you quickly what happens is people just start hedging the rent control, right?
So they say, well, if I can lock in a good rent, then, you know, I have a kid.
My kid's 10 years old.
Eight years from now, he'll be 18.
Let me just get an apartment and rent it at you know whatever the controlled
price is now and that way if the price goes up then my son can live in this apartment when he's
of age right um and so you end up with just massive uh vacancy which is what you have in
san francisco and in new york city actually um and uh and he just said you know every time they've
done rent control uh you end up with
with huge vacancy rates now there's a question of like is vacancy rate the right metric for success
um you know i don't know well but i mean couldn't you but it's always one of the things where
people feel they're different so you know mountain view just enacts rent control but oh but we're
different or we're doing it this time or we introduce this tiny slight difference where you know basically if it's vacant then you
know you lose the rent control or something right like you could always try a slight variation on it
uh or it'd be different this time if that makes sense i don't know yeah i know what you're saying
um yeah i mean maybe you know i mean i mean
obviously the more like uh the more restrictive you make the allocation of rent control the closer
it's going to get to a freer market so there's some gradient there but yeah i mean who knows
it's a good question i mean this is the uh well what is his name oh oh man now this is the, uh, well, what is his name? Oh,
oh man, now this is going to bother me. Uh, Nassim Tlaib, the black swan. I think it's a black swan
is where he talks about this is the, you know, the Turkey befriends the farmer. I've probably
told this story before. I don't know. It's actually his story. I've never heard it. Oh, okay. The, the, the Turkey's on the farm and, you know, every day
the, the sort of Turkey sees the farmer and, you know, the farmer feeds him. And so the Turkey
goes, wow, this, this farmer is my friend. And, you know, oh, this farmer is my friend. And this
goes on for, you know, like a year and the, you know, Turkey's completely convinced that
this farmer intends me no harm, that he's my friend.
And then one day it happens to be, you know, the day before Thanksgiving and the farmer is not the friend of the turkey.
And it's like, you know, everything's the same.
And you can come up with, you know, hey, look, every time we've done this, it shows that the farmer is my friend.
And then one day it just isn't.
Yeah, I see your point. And so, like it just isn't. Yeah, I see your point.
And so like you can say,
oh, I have a model.
I have an understanding.
I have my Bayesian prior
until none of it works.
You know, and I hope it's hit that book.
And the reason why I say I think it is
is because basically that's the black swan.
Nobody believed black swans existed
because everyone had only ever seen white swans right so there are only white swans in the world
the only color swan can be can be white and then someone finds a black swan and they're like oh
okay black swans yeah exactly yeah i mean it's a good question i mean i think but to your point
that's why economic systems are constantly failing.
So that's another thing is, you know, there's just, I mean, we've seen basically every seven years there's some big crash.
But then even then there's these micro failures in the economy.
And sometimes they have to sort of, like they talk about in this book, like one third of Venezuela's oil was like just messed up.
Like, I mean, the oil was fine, but just the pricing just got jacked up.
And a bunch of like World Trade Organization people had to basically just step in and start doing manual things.
Like this person was, you know, guaranteed to buy this oil.
And then they just like canceled the guarantee without any penalty.
They basically had to like do this arbitration among all these people manually because the system had just failed.
So, yeah.
Well, my book is nothing so serious.
It's a science fiction book.
And I recommend a lot of hard sci-fi or you know sci-fi that's like i guess
you would call it deep long form sure you're very interested in kind of the world building stuff or
whatever and this one is not like that at all uh so this is fuzzy nation by john scalzi i've
recommended uh books of his before uh and this is actually a retelling of a older book um just sort
of like updated and made made newer i haven't read that older book, so I don't know anything about it other than in the sort
of preface they discussed that, oh, this is a retelling of a older sci-fi story for modern
times.
And it's a story about a person who is some amount of time into the future, you know,
on a different planet some
interesting things happening um but it it sort of pivots around the interactions of uh the people
and the companies and the planet and some of the native species of the planet and a question about
just like how and when i say a question it's not like some deep thought provoking oh i really wonder it's
just a light-hearted story about kind of like what what does it mean to be sentient or alive
or how should we treat you know things as humans and it's not asking it's just a play on that i
should say rather than questioning it um and so i'd recommend it it's a very easy read or at least
i found it to be very lighthearted and easy.
And since I listened to it, not read it, I guess,
easy read and easy listened,
you didn't have to like sort of,
oh, what was happening there?
I really have to focus.
You know, you can just sort of,
it's kind of fun and goofy and humorous at times.
So that's Fuzzy Nation by John Scalzi.
Cool.
Yeah, I also listened to the Basic Economics
or still listening to it. Oh, okay. And basic economics are still listening to it okay and uh
yeah we're listening to it on audible yeah is that cheating i feel like i just say red but
it's because i think it's the right thing to do okay yeah i think red is fine it's just too
confusing yeah we should we should ask the folks at audible so um yeah if you uh if you want to
listen to these books and tell people you read them, you can check out Audible.
You go to audibletrial.com slash programmingthrowdown.
And we have a link to that in the show notes.
And if you go through us, I think you get your first book free.
Is that right?
Yes.
First month is free.
And we also get a thank you from A which uh which is really great for us and
helps keep the the server lights on on the servers um we're also if you already have audible or you
want to donate in a different way we have patreon um we have a custom patreon rss by the way i
haven't ever mentioned this on a show i've talked about it a little bit i mean it's on the patreon
page but uh the downloads are faster um the uptime is a little bit. I mean, it's on the Patreon page, but the downloads are faster.
The uptime is a little bit better.
So if you go on Patreon and give,
I think the minimum is a dollar,
you can get access to the really fast RSS feed
and get the downloads a little bit quicker.
And we, just an update,
I guess we could do it later,
but for the people people we had said everyone
who was patreon at the new year was going to get a little programming throwdown badge thing i don't
know what you call it like a laser cut thing i am staring at a giant stack of them sitting on my
kitchen table nice um so we did a couple of trial runs yeah i was gonna say we ran into some
manufacturing difficulties that's what jason and i had to iterate this more than i anticipated we were going to have to i thought oh this will
be easy it'll be great and yeah it turns out this is why kickstarters are hard and this wasn't even
a kickstarter and people aren't even you know anyways yeah i mean nobody's really written in
saying hey where's my uh you know uh like, where's my thing? And so.
Yes.
Thank you for your patience.
Yeah.
Thank you a lot for that.
Yeah.
Definitely mass producing things is hard.
You know, props to Cafe Press for drop shipping our T-shirts.
Yeah.
They have like, you know, the system.
But, you know, for us, it's like once a year thing.
So we don't have a real system in place but we're gonna get it done we went through some manufacturing issues but the latest uh
set has been has been solid yes and so we say manufacturing issues what we mean is like
when i when jason makes the design and i laser cut them and then i mail them to him
and working out that like how thick the plastic should be and how do we mail it so that it doesn't crack
on the you know so that you guys don't get just like bits of plastic instead of a nice programming
throwdown logo so exactly it's been fun well we should talk about it so i'm going to write it up
anyways it is kind of interesting i have all the pictures we should make like uh like a little
kind of blog type post about yeah but i do but I do have, what is this? This is about 25% of them are more sitting on my kitchen counter.
So I'll be sending them your way shortly.
Very cool.
Tool of the show.
Oh, sorry.
My tool of the show is hyper.js.
So I was doing some work on Arduino, which we'll talk about later.
And I wanted to have a good Windows setup.
And I was also doing some Raspberry Pi work and stuff like that.
And I have the Ubuntu bash for Windows thing.
I don't know really what you call it.
But the thing where it's like Ubuntu is running inside of Windows,
but it still runs in the Windows command know command line app which is not that great
um and i found this hyper.js it's really really cool it's basically it it's all implemented in
javascript uh it's built on electron uh which is what you know a lot of apps nowadays are built in
so they could be kind of cross-platform and And, you know, it's just a super, super nice terminal.
It has tabs, it has multiple windows,
all the things you kind of expect
from like a really nice terminal.
And the thing is, you can use this on anything.
So kind of if you learn the shortcuts
and how it works and stuff like that,
you know, that knowledge will carry over to any machine.
You could be on Mac, you could be on Windows,
you could be on Linux, HybridJS works on everything.
It's super, super cool.
I'm actually thinking about trying to make it
my defacto terminal.
I use iTerm right now at work, and I'm using this at home.
And on a couple of the computers at home,
I'm still running the GNOME terminal.
I'm thinking about just taking the plunge
and just doing HyperJS for everything.
But so far, I'm really liking it.
I know that, I think I recall when this first came out
or gained popularity,
and people were sort of complaining that,
oh, look how long it takes from when you type
or punch a button on your keyboard
to when the letter appears on the screen.
And I know they have the same complaints about Atom,
which is an electron-based text editor,
about being slow and problematic.
Yeah, that's actually fixed.
Yeah, I was going to say, yeah, well, they did fix it.
But before it was a legitimate complaint.
Yeah, i saw the
you know github issues like kind of complaints about it like some of the github issues are still
open um but basically yeah they they just did a bunch of work on the back i mean i don't know
specific i know one of the things they did is they wrote their own terminal emulator instead of i
guess there's this thing called h term that's built into Google Chrome.
And that was slow.
They replaced it with something else.
But yeah, you're going to see those issues on blogs and things like that.
But I haven't found that to be a problem anymore.
Well, yeah, what I was going to say is like I've used Atom and there are faster things.
I've not tried this, but i think a lot of it just
depends so i wouldn't be dissuaded off of stuff just because of bad blog posts like anything you
got to try yourself yeah that's true too i mean i didn't try it when it was slower i mean maybe
it's it's still slow i just don't care that's what i was gonna say is maybe this stuff is slow
and i just run on fast enough computers that it doesn't bother me yeah like i tend to run on
computers that are quite well specced i guess for stuff like text editing but i can imagine i mean
it's a legitimate complaint like there is no reason a text editor has to take that much ram
um but for most people it probably just doesn't matter. Yeah, I mean, I will say, you know, HyperJS, it's all JavaScript and HTML.
So, you know, in other words, if you press L on the keyboard, you know, it's actually updating some HTML component.
And so, yeah, that's going to be way slower than any other terminal.
But, I mean, it's completely imperceptible. I mean, things that would bother me would be if I ran a command that generated, let's say, effectively an infinite amount of output and I had to kill it and that command wouldn't die.
That would be really frustrating.
But I tested this out.
I did like a find slash where it's just going to list every single file on my hard drive.
And I killed it, you know, instantly.
So, yeah, I haven't had any issues
cool uh my tool of the show based on the previous manufacturing defect thing is that i have a laser
cutter uh it is a very low-end uh cutter from china called the k40 and normally you have to
install which is why i actually didn't buy it even sooner than i did end
up buying which i've really liked and it's worked well for me although there are tons of caveats
around it and stories of people's stuff catching on fire so always keep my fire extinguisher near
um and never leave it unattended well it turns out if you're you know cutting stuff with a laser
and like it makes fumes and those fumes could ignite like yeah of course like you
need to watch what you're doing and have proper fume extraction and air blowing to disperse the
fumes and keep an eye on it um okay that was really terrifying sounding patrick is is sacrificing his
life for our patreon subscribers and be careful what you cut just if you're if you're going to
get a laser cutter because some stuff you cut will release toxic gases um but there are laser
safe materials anyways okay long story short the uh software that you're supposed to use to run
this is like ranges from well is there any way this could possibly work to i'm definitely getting a virus from installing this
and so i was really not wanting to do that and you have to like you know sort of plug in a usb
hardware dongle to run what some people sort of say is like a counterfeit version of some software
or a pirated version of some software and then there's a plug-in and it's just like oh i really
don't want to be messing with this why why is this so hard like you basically have to just point the laser using a couple stepper
motors and then turn it on correct but these these are made for people who use some specific
software package to i think it's actually said that this is for making um sort of stamps based
on your name in chinese um but they've just found out they're generally kind of cool and useful for
hobbyists and they're really cheap to make.
And so they've been sort of retasked and this is the,
whatever company that sells them,
this is their solution and it's just not very good.
So instead one option is you could replace the controller board that
controls the stepper motors to just take G code like a 3d printer would be um and there's lots of people who do that and i've
considered doing that because you can actually get more control over it um sure but what you
could also do is somebody basically sniffed the protocol and figured out what this definitely
virus laden software was doing with keyloggers um They basically figured out what protocol it was doing and they wrote
a very simple UI where my workflow is basically Jason kind of makes the pattern and I think
maybe you use Illustrator or Inkscape, I don't know. And then I sort of edited up an Inkscape
to be sort of what I need and then you import it into the software K40 Whisperer. So the name of the laser cutter is K40.
And this guy made this free software
and has a source code for it, K40 Whisperer,
that will allow you to control the laser
and cut your designs without having to install
horrible, unknowable software on it.
And it's been awesome.
I've really liked it.
And it's crazy what
people do and then just sort of like release for free i'm always sort of yeah this is nuts i'm
always sort of you know shocked that i guess this guy is doing programming in his free time because
he's not i was gonna say would you hire him i mean i don't know i've not looked at the software
but i am appreciative that he's doing the work yeah it makes sense although it's an interesting
thing i was thinking
about this because i think it's a quite difficult problem so we were talking about 3d printers the
slicers um right most of the slicers are sort of free and so you i guess you get what you pay for
at some level but um they do a lot of random things that seems like they should be able to
do better and it is a really tricky problem but you know these are people doing this in their free time and a lot of them are probably i assume probably self-taught
um and the complexity of the things they're doing is actually quite astonishing uh given those
constraints but it's like wow it really seems like you ought to be doing better because there's often
where you'll just get these movements where the print head or the laser cutter will just sort of
like cut down in the bottom left
and then move all the way up to the top right
and do a little more cutting
and then move all the way back again.
And it's like, huh, it really seems like
you should have been able to run some optimization
and not do that.
I think you found your next side project.
Oh, no, no, I keep thinking that.
I'm like, no, I bet this problem is way harder than I think.
Yeah, so I won't fool myself but k40 whisper if you're in the very small minority of people listening who has a laser cutter and that laser cutter happens to be this thing and happens to
be one of the ones compatible i would definitely check this out but you probably already know if
you are but anyways shout out to to these guys this is amazing yeah very cool all right so we are going to try our best to cover arduino there's there's a lot to talk about
um i mean we could go all day about maker whatever but um but yeah we'll talk about arduino
kind of specifically and uh if you have any questions about any Maker stuff, just post on Facebook or anything like that.
Yeah, so Arduino, I think a lot of people have probably heard about it.
And Jason sort of said the kind of Maker movement or making things.
I mean, Arduino, I remember when it, you know,
was sort of first coming out and people were,
wow, what is this overpriced thing that is coming out of Italy and is, you know,
underpowered, draws too much, you know, current
and is sort of laughable.
And that was sort of the people who did embedded programming,
which is something I was involved in at the time,
which is why I was sort of peripherally aware of this.
And in a lot of ways, they were right.
Objectively, the Arduino shouldn't have worked.
It was made by people who kind of didn't know,
at least from reports that I can understand,
they were students at the time.
They kind of didn't know what they were doing,
and they made a bunch of sort of,
what would you call, I guess, like rookie mistakes
in designing the PCB for Arduino,
the sort of power adapters they've used.
And then in what is, you know, a great show of
it kind of often doesn't matter.
It's not the best solution that wins all the time.
And I guess Arduino hasn't won in that it's not by any means the most
commonly shipped microcontroller but it almost in my estimation probably single-handedly created
the the behemoth of using microcontrollers for this maker and hobbyist movement uh that it is
today yeah um i think a big part of it is they're pretty well connected with the maker community but
they're also uh very accessible and you know not only are they making this board but they're also
writing all these tutorials um you know they have a bunch of assets there's a whole class of
you know oh here's a bluetooth chip uh that's designed for
the arduino which means that there's a library which we'll get to later that you can link in
to make use of this chip and so it's kind of like uh all of that extra work probably
matters a lot more than you know do you have the best design yeah and i don't think anyone
had attempted to think that was a market before that you know yeah there was basic stamps i don't know if you know about these
basic stamps anyways um where you could write code in basic and use microcontrollers and i knew about
these or whatever but they were always like quite expensive even compared to to these um and this
never caught on because like you said there was never this uh enough of a network of tutorials
and people using it and easy to use as a you know priority kind of thing they just never seemed to
catch on um and then also one of the things that it was one of the very early things that is probably
not the first by any means but it's one of the things i remember as being kind of an example of the open hardware and open software,
where, you know, before people would say, well, here, I'll open the hardware, but I'll keep my,
you know, drivers and firmware closed, or here's open source software, but I am not going to tell
you the exact details of what I, you know, put on the chips and in the um you know in the board but the arduino stuff is open both
the ide the software that goes on the sort of so-called firmware that goes on the the chips
and the boards themselves are all completely open yeah yeah that's right um so yeah there's
there's no reason why someone couldn't make you perfect replica of an Arduino and sell it themselves.
And people do.
We'll talk about that.
Yeah.
But I mean, I think the difference is that you just can't use the name.
But yeah, so the Arduino really is this, as Jason was already sort of talking about, more than just the board.
It's the board, the communities, the libraries.
And we'll probably accidentally use the... When we use the term arduino for me i really
mean all of those things together yeah um it isn't just any one of them um so the first thing to talk
about is is sort of this arduino ide it's really not an amazing ide it's relatively simple in fact
i think arduino project uh used it from i believe it's the processing project or
something um where they already had this ide and they sort of reskinned it ported it um there's not
really much to write home about but what's interesting there is that because the arduino is
often the first embedded hardware and well unless you've done phone development is is common now i
guess it's pretty similar where you do cross compiling where you have an ide and unlike visual studio or gcc
where often you compile code and then run it on the computer that did the compiling
you're compiling code on your computer and then sending it to a different kind of computer
in this case the arduino which is we'll talk about in a minute, an AVR. And so you're doing this cross-compiling.
So that's sort of one interesting nuance.
And the second thing is that you then need to do the quote-unquote programming, not the write your program programming, but the putting your program on a board called programming. And so one of the things that the IDE is responsible for doing is making sure that
you're doing the correct protocol for programming the boards you have plugged in and sending that
code over. And then also doing the remote debugging where you can sort of, if your program goes awry,
you can debug it from that IDE. But it does so over the USB connection to the board
because the program isn't running locally
your IDE is running locally
but the actual code is running on the Arduino
right, yeah exactly
yeah, I've used the Arduino IDE
for this robot arm I'm building
and yeah, I thought it was pretty reasonable the Arduino IDE for this robot arm I'm building.
And yeah, I thought it was pretty reasonable.
I mean, as Patrick said, it's nothing to write home about.
But you know, it seemed you got the job done.
It has some basic functionality.
It'll tell you if you have errors, things like that.
So one of the things that is interesting about the Arduino is that it is just really C and C++ that you use to do the programming in the Arduino IDE.
I guess I should say that in actuality, you can run the same compiler that the Arduino IDE is running under the hood.
And you can do everything yourself.
And you could write in any language that has a back end that supports that um which i think there's probably llvm support for the avr back ends
so you can probably write in almost any front-end language you want so you know probably c c++ java
i don't know any any whatever llvm supports which is basically everything um but what is interesting about the
cnc plus plus that the arduino it uses is this thing called wiring which is really just a set
of they call it a core the core um it's a set of functions for doing things like turning a pin
from a low voltage to a high voltage which could turn on an led for
instance or reading a value off of a pin so that you could for instance tell what voltage is being
applied to that pin which you could you know control from a variable resistor and those are
really just function calls but you write them there see function, but you write them, they're C function calls, but you write
them in the sort of skeleton app that the Arduino IDE provides you. And you really don't even know
that you're writing C for the most part. You're not doing the things we traditionally associate
with C or that I would associate with embedded programming, like using bit masking to set
register values. That's all hidden away from you in a set of C function calls
that you could think of as the Arduino API
or as this wiring language or what they call kind of the core.
Yeah, so you're operating at this layer where you're just saying,
hey, is the pin 7 high?
Is their voltage coming across pin seven and uh and it
just says yes or no so it's a boolean function but under the hood they're probably doing all
sorts of wizardry like i guess they're checking the voltage that's above some threshold or
something like that yeah i mean what they're doing is they're reading and writing what they
call registers which are memory mapped uh ports that
give you you use and access as if they were bits of ram but they're not they're um physical circuits
and uh but that's you're basically just scripting it but you're scripting it in c
so this very accessible maker thing is really written in c which is somewhat uh
not what you would expect,
I guess, that that would be what caught on.
Isn't there another language, though, like Scratch or something?
Or am I just making that up?
But I thought the Arduino came with like a language that they were pushing and the C
was like an optional thing.
I think, I mean, this wiring is this set of functions i don't know that it's
any other language than just c oh okay so there is something called a sketch and a sketch that's
what it is sketch a sketch just means a program though but different than if you sat down and
wrote a program for your computer you would you know start it in c you would start with you know int main uh you know and then the
i'm not gonna say it out loud because it gets hard but uh the the type signature necessary for main
and then you would write your code in there um but one of the things that a sketch does
is it really just says hey i need you to provide two functions for me the first is setup where you do your setup
and then a function called loop which is i'm going to call it in a big loop for you and i want the
thing that you want to do repeatedly you should put in this loop function and then what it does
is the sketch has an external file that has that main and it calls the underlying platform the board setup it
configures all the clock speeds and everything in this init function then it just calls your
setup function and then just calls your loop function in a uh basically a wild true loop
um so there's a wild loop and it just calls your loop function uh and so a sketch is a file
which you i think they have it dot ino and uh dot ino file or whatever but that's really just a c
bit of c code that they embed into this other you know framework and they just call your setup function and call your loop function
and you are just writing c in there but you often call these other functions that do all of the you
know heavy hardware lifting for you yeah that makes sense uh it you know it when i when you
kind of know what's going on it's surprisingly of simple, but it is rather clever to do it this way because it really makes all of the explanation you have to do to someone about why main has a bunch of parameters that come in and why is void main considered bad.
Like, why are you supposed to have int main?
Yeah, exit codes and all that.
Yeah, like no one wants to explain that stuff.
Like it's actually not really, I mean, it is important,
but it isn't the most important thing to a beginner.
Yeah, the other thing that's really cool is there's a list of example sketches,
and they're all one file because, you know,
all the main and everything else has been done for you,
and there's so many other libraries, et cetera, et cetera.
So most of the time, you can do something simple in just one file.
And so there are sketches that just one of them turns a stepper motor,
like 360 degrees clockwise and 360 degrees anti-clockwise,
and just keeps doing that in a loop.
Another one has like a little joystick and you wire up a joystick to the correct pins,
you run this example sketch, and then it'll just tell you the x-axis of the joystick. It'll just
print it to the screen. So if you move the joystick to the left, you start getting negative numbers,
you move it to the right, you start getting positive numbers um and so these sketches these example sketches are just like right there in the ide you just go in a file
example boom you get a list of like 30 examples um you know they all require some some hardware
which we'll get to later there's packages that have all of the example hardware um but yeah just
having that resource is super, super useful.
Yeah, I mean, oftentimes, this has become now my thing
with picking a Linux distribution is,
I just want a Linux distribution that's most likely
to have the answers to the question before I ask it.
Yep.
And that sounds really dumb,
but I guess I've somewhat optimized my life around this
for several things now,
where if I know I'm getting into a hobbyist thing i just i kind of want to pick something that i know is
going to have answers before i have a problem because otherwise i'm going to waste all my time
trying to get them and arduino is really successful there as jason said like they've already given you
examples on how to do a lot of things you're going to want to do read a resistor a variable resistor value a knob move a motor turn on an led you're not going to have to you know post a
question on stack overflow to figure out how to do that right and some things have specifications
like for example um there's an lcd panel where you can wire up i think it's like four or even eight pins it takes.
I think it takes four pins.
But, you know, with those four pins, there's an entire protocol that's saying,
okay, you know, set these pins at these times.
And, you know, with just those four pins,
you're going to display a whole bunch of stuff on this LED.
Like you could fill the whole LED full of characters, right?
LCD, sorry.
And generally, that would be kind of a huge pain.
It's some custom protocol.
It's probably based on timing and all sorts of stuff.
But Arduino just has a library for that protocol.
So you import this Arduino library,
and then you just say, hey, I want the LCD to display JSON.
And that's it. You don't have to think about the protocol it does all the work of of you know sending the
right thing at the right time to just make the LCD display whatever you want and the thing that
Arduino does one of the things Arduino does really good is instead of exposing you the 20 parameters
that that protocol has,
it just picks a reasonable default
and doesn't bother you
with the details.
And you probably can get
the details if you want them.
But traditionally,
you would have been exposed
to a giant function setup
where if there was already a library,
which there probably
wouldn't have been,
you would have had to go
to the data sheet and figure it out yourself. And wouldn't have been, you would have had to go to the data sheet
and figure it out yourself.
And even if you did,
you would have had to answer 20 questions
you didn't know how to answer about timing,
how fast you wanted to refresh
and what amount of power do you want it to draw?
Yeah, exactly.
I mean, I plugged in an LCD panel with Arduino and yeah, you know, put in a string and boom, it's rendered. So yeah, Arduino is, and maybe it's because, you know, Arduino knows the mega there's there's only a handful of different arduino
chipsets or boards so um so they probably just handle these cases for you and they know what
the right defaults are well yeah so so the we'll talk a little about the processor originally the
first ones were targeting 8-bit atmel AVR chips, which are quite cheap chips.
And the fact that they were 8-bit doesn't mean you could only do 8-bit math. It just means the
processor is natively 8-bits. And so doing anything more than 8-bits takes multiple instructions.
I won't get off into that right now. But they're surprisingly sort of low amount of resources and low amount of speed.
But people still manage to do a lot with them because you're not doing things like rendering full graphics to a display.
And so you can do, you know, kind of a lot with them more than you would think.
But now there are, as Jason was saying, there's a whole bunch and they have moved on to other different kinds of processors. And the other thing to point out
is that although the Arduino line itself is actually still, although much bigger than it was,
still pretty small, there isn't anything from stopping you from implementing this core for other processors. So people have taken, you know, before Arduino had a Wi-Fi option, you know, took chips that
had Wi-Fi on it and ported it.
They've taken faster processors and ported the core to it so you can write Arduino sketches
for other boards.
But one of the things that was pretty distinctive and other boards have adopted them as
well that wasn't just this easy to use interface over the processor but they also did this
certain board shape where they had these female headers facing up which are headers you could
plug into and they exposed a lot of the almost all of the pins on these headers that face
up so that you could you know a you could just poke a wire down into them to use which is when
jason says he hooks up a screen you may just be as simple as literally like plugging a wire into that
um that header uh and then they had what's called shields which like sit down on top of that in this form
factor and plug right in and you know expose all the proper pins that you're going to have on this
shield this extension board this add-on um is going to be exposed right to there and that was
something they did that maybe other people had done that before but that was the first time i
had seen something that that did that it was really quite clever yeah i'd never seen anything like it before the other thing too
is you might say like all these ships are so underpowered etc etc let me just get a raspberry
pi the raspberry pi is like 20 bucks right the thing about it is um you know the os is as patrick
was saying the os is super super lightweight and on top of that the os is wait
there is no os to be clear in the arduino uh well what is it called then i guess firmware
i guess the i mean it's just the program yeah okay that's sure you could call it firmware that's fair
yeah yeah yeah so uh you know raspberry pi uh let's say you miswire something
and you want to you know shut down the raspberry pi plug in some different discrets and turn it
back on like it has a boot up sequence you could corrupt the file system right unless d card right
it's not really designed for you to be constantly plugging and unplugging things um you know it's
gonna take a long time to boot up, etc.
The Arduino just starts within, I don't know,
two seconds or something.
There's no disk, no file system
that you're going to corrupt or anything like that.
And it has...
The ResRate Pi has a lot of the same pins,
but for development,
it's going to be a very painful
experience to develop on the pi yeah as jason pointed out i mean the raspberry pi processor is
way more powerful than what's on the arduino but they're not really meant to do the same thing
right yeah so you're not you're not meant to be rendering windows in a full linux distro
uh if you they actually do have an arduino now be rendering windows in a full linux distro uh if you they
actually do have an arduino now that i think has a full linux distribution on it um which is sort
of confusing but for the most part weird that's for the most part that's not what people use
the arduinos for it's more like jason said just you would have it to toggle some pins turn on
some leds move some motors um and doing that from Linux is, to me, actually slightly awkward.
Yeah.
Yeah, I mean, and if you wanted, if you needed the horsepower
to run, like, a camera or something like that,
you could always take something that works on the Arduino
and, you know, as long as you're using the same pins on the Raspberry Pi
or do some mapping or something like that.
But you don't want to be doing the development on a Pi.
That'd be bad.
Yep, and so one of the things about all the different hardware,
as Jason already mentioned,
is that they have these really awesome libraries
that you can download and use.
So there's a bunch of included ones
for things like moving stepper motors,
but then there's all sorts of other ones for things like moving stepper motors but
then there's all sorts of other ones for like i want to know the barometric pressure outside
i want to know the temperature from this chip i want to record sounds i you know all sorts of
little chips that go into cell phones and cars and airplanes and you name it uh you know
accelerometers whatever these kind of devices get made in the by the millions and airplanes and you name it uh you know accelerometers whatever these kind of devices get
made in the by the millions and millions and people mount them on you know adapter boards
little pcb boards to work with arduino and then provide these libraries so that they're just
become really quite easy to use yeah i mean one thing that kind of shocked me when i first got started with arduino a few months back
is uh the fact that yeah i mean if you need drivers for everything right i mean like like
even if you get let's say hypothetically you get a usb adapter like a usb i think usb is just four
pins right so you could you know take a usb device and you could plug it into four pins, right? So you could, you know, take a USB device and you could plug it into four pins
in your Arduino. But at the end of the day, like you need a driver, like with Linux or with Windows,
you plug in a USB joystick and there's like a generic, you know, hid driver that covers almost
any joystick, right? With Arduino, I mean, that might exist also for Arduino. I haven't actually looked about joysticks.
But it's a completely different universe.
And so things which are very simple when you have, I guess, to use Patrick's words,
when you have an operating system, you become very hard in Arduino as well.
But that is the way it works.
So this is actually great education.
And there is a lot of job opportunity for this, which is things like, you know, the exact protocol
that's running over USB that allows your joystick to work or that your phone processor uses to talk
to the camera to control it. But if you're on Arduino, you're going to be thinking about those
things. And there are a lot of libraries to help you out. But you're going to learn about how those
things work and what it means.
What are the tradeoffs for running those protocols faster or slower or over long distances and about what happens when different devices require different voltages to work at?
Yeah, I still haven't figured that one out.
So we talked a little bit about external hardware but the arduino also has some internal hardware so it has some voltage regulators so providing different voltages on its output pins
it does have um some analog to digital converters which are what allow you to read external voltages
so if you hooked up a microphone or a light sensor or um you know like we were talking about uh you know a potentiometer a
variable resistor um that you were using to use as like a knob to control you know the position
of something um those all ultimately produce a what's called an analog voltage it's just a
voltage that moves smoothly between a two set value so it might
go zero to five volts and it could be just any value in between but of course the arduino can't
represent the infinite number of values between zero and five so it has to make them into discrete
steps and it's called sampling it samples them and makes them into the discrete set. So if you say zero to five, and I'm going to use eight bits.
So I have 256 values to represent between zero and five.
And so you cut up the range zero to five into 256 buckets.
And then you see which bucket the voltage currently falls in.
That's what an analog to digital converter does.
And the Arduino has some of these internally so that you can use them in libraries for making it really easy where you just say i think it's just analog
read and it just gives you a 0 to 255 answer for which bucket the voltage is currently in
yep yep um then you can do uh it can do analog out which i believe the base arduinos don't
actually have digital to analog
converters which would give you this so instead they do what's called pulse width modulation
which i won't get into it's actually really complicated but basically it makes a square wave
that is on for a certain percentage of the cycle and then smooths that out with a capacitor so that you get a voltage that's roughly,
you know, corresponding that.
So you could do analog, right?
Or if you wanna move a servo motor,
which uses PWM directly,
that would be how you actually move it to a certain angle.
That's right.
So I have, you know, the robot arm is just done
with a bunch of servos.
And if you, as Patrick said, if you give, let's say, three-fourths of the voltage, then it's going to move three-fourths of the way. You know, if zero is, you know, all the way to the left and you give it three-fourths of the total voltage, it'll move, you know, three-fourths of the way from left to right. And you can control it.
And Arduino abstracts all of this away to where you literally just give it the degree.
Oh, really?
The angle?
Nice.
Yeah, yeah, exactly.
You just say, like, I want it to go to angle, you know, 45 degrees, and it just figures it all out for you.
That's really nice.
Yeah.
And then we talked a little bit about shields.
So, I mean, do you have some – have you used any shields, Jason?
I haven't.
There is a servo shield.
So there's, not to get into too much detail about this, but there's stepper motors and servos.
Basically, servos can only go, I think at most, 270 degrees.
So they can't, you know, spin around in a circle or anything like that.
But the servos are self-aware
so you could tell a servo you know go to degree 23 and it'll just go there right it's a closed
loop closed loop yeah and when it starts it knows what degree it's at and everything um
well it's more than just closed loop right right? Because a stepper motor, I believe, is also closed loop.
No.
No?
Well, the stepper motor, you give it a difference.
You say, like, I want it to take two steps,
and then it will make sure that it takes those two steps.
Oh, this is getting really off into pedantic stuff.
It's not important.
Actually, the stepper motor, if you're holding like the motor or it's
like over torqued and you tell it to move and it can't it won't actually know if it succeeded or
failed oh which is why if you're if you ever have your 3d printer hit the print and skip where it
like misaligns that's what happens it it lost steps it hit something and couldn't move but it didn't know
it couldn't move the servo the servo is closed up it will continue to fight you and if you hold it
it will just keep fighting and until it gets to the position you told it to interesting okay so
but anyways the stepper motor takes i don't know why the stepper motor takes so many more pins.
It's probably just whatever the different technology is.
The stepper motor takes two pins, and the servo only takes one.
And so there's a shield you can buy, which gives you just a lot more pins.
So you can control eight stepper motors or something like that.
But yeah, I haven't had a need to do that since i'm only using servos mostly uh yeah so but there's shields for
everything so you can imagine so a printed circuit board a pcb is like a piece of fiberglass with
metal traces and the circuitry sitting on it and that's what the arduino board itself is
but then you can basically get another board that plugs into the arduino board that is shaped often similar to the arduino
board and you could have a display on it you could have like jason was saying a whole bunch of
connections for servos and stuff uh you could have it like be able to control lots and lots of leds
there's all sorts of crazy ones there's ones with batteries on them so you can actually run the arduino without it being plugged in oh cool yeah so you can find all sorts of uh shields and these shields are just
like a common shape and a set of libraries is normally what's expected that allow you to plug
in to the arduino and add functionality add hardware that it didn't start out with
yeah that makes sense.
So I think we've talked about, we've mentioned GPIO.
We haven't said what it is.
GPIO just means general purpose input output.
And so what that means is the, you know,
you can plug something like a servo into one of these pins and send signals out to that servo, you could also plug in something like a joystick
that's sending data into the Arduino, and the same pin can do either or.
Yeah, so sometimes a pin could be an input, and sometimes a pin could be an output,
and it can switch back and forth it's it's programmable
right um so yeah so as far as things you plug into the arduino so um yeah there's i mean a ton
of stuff there's there's as you said motors lcd panels um you know there's things that sense water
so you can have a little thing which is like, it looks kind of like a long circuit
board. But what it's actually doing is it's telling you the
water level. So it's just, I guess, I'm not quite sure
from a physics standpoint how it works. But you would stick this
and it will just tell you how much
of this board is full with water,
so where the water line is.
There's all sorts of crazy stuff, cameras, there's depth sensors, things like that.
But ultimately, everyone wants to make a robot, is that right?
I feel that's the...
Yeah, I mean, everyone at some point know some type of motor or some set of motors
and then some type of input um you know there's like a camera or or some kind of like a stop
sensor or something like that and all of that is totally doable with arduino and the libraries make
it make it super super easy to use so there's like a depth sensor um that's compatible with
arduino which which typically when
they say compatible with Arduino, what they mean is that they're providing some type of software.
The Arduino IDE also has a sort of repository of libraries. So if someone makes a depth sensor,
they can upload the depth sensor, uh you know library to to the
arduino you know cloud i guess and um so you'd put the part number and you'd get their library
and uh yeah the libraries are really where the magic is because like i've been getting kind of
more into it i really thought that i was gonna have to learn a lot more than i actually did
and it's because the libraries are just hiding all of the complexity from me.
Yeah, I mean, I think Arduino is really awesome.
It isn't something where you would ever get a job using an Arduino.
I mean, maybe there are, but it would be an exception.
Yeah, highly unlikely.
Very unlikely.
But it does introduce you into a world it's a bridge because
to go from not knowing how to program to doing embedded programming is a really big jump there's
a lot of things you have to pick up and so what the arduino has really done um or has at least
brought into the mainstream is the ability to use a little bit of programming
and a little bit of understanding of electronics and still do really cool things.
Yeah, exactly. And so there's, there's a lot of kits and starter packages. Um, I'll say the one
I got, um, I think I, my heuristic was basically a lot of Amazon reviews. So I didn't do a ton of research, but they're also not very
expensive, which is really nice. So I got the Elegoo Ultimate Arduino Kit from Amazon.
But basically, it came with a... Elegoo is a company that manufactures electro components.
And so they made made following the spec
that open source hardware specification
they made their own Arduino
and so you get this kit
it's
I would say it's maybe like
16 or 18 inches
by about 12 inches
but it's about
2 or 3 inches high so it's relatively thin
this box comes with a bunch of like this, but it's about two or three inches high. So it's relatively thin. This box comes with like a bunch of resistors, voltage regulators, all sorts of sensors, motors, servos, stepper motors, all this stuff, the Arduino.
And then you can go on their website or you can using the CD that's included.
I literally didn't have a CD reader but I
got everything off their website you know PDF manual and it's a really long
manual you don't have to go through all of it but it's just a ton of different
things you can do with Arduino so for example you know I want to build this
robot arm so I went straight to the servo section.
And the cool thing, it has pictures.
So it has a sort of schematic of what it should look like once you've plugged in the servo and everything.
And then it has like actual real-life pictures of what it should look like.
So if you have trouble reading the schematic, you can see the picture and say, oh, like I'm doing this wrong or what have you.
The other thing, I've yet to you know blow anything up actually i did blow up a stepper motor controller um that was
completely my fault um um it's kind of a long story i basically touched it on this like box
this metal box and it shorted out um so yeah just quick psa don't have like a lot of metal things
around um when you're when you have just like bare pc and when you say blow up i assume you mean
you let the magic smoke inside the chip that makes it work come out yeah actually like caused
explosion oh no no it was just a tiny pop, and some smoke came out.
And that stepper motor controller was only like 80 cents,
so it wasn't a big loss.
But yeah, yeah, nothing, like I was in no danger or anything.
But yeah, so I went through this kit, and it was fascinating.
I mean, I learned so much by going through the kit. They also explain things like how to read a resistor.
So the resistor has certain colored bands,
and there's a certain procedure where you can look at those bands
and then know the level of resistance.
So it talks about a lot of – it covers – it touches a lot of different areas.
And you end up with, like, real, like, tangible things
that you could take pictures
of show your friends stuff like that so so check it out all right that's well pretty much
we must have had a lot of uh pent-up discussion because this has become a very long episode
yeah yeah there's a lot going on it's been a
it's been a long time but uh thanks again for everyone for your support we're definitely going
to get the um you know christmas gifts out asap so probably in the next you know few weeks or
month or so yep um and uh yeah definitely if you've built anything with arduino send us some
pictures we'll post it on facebook and uh we've gotten a lot more Facebook followers.
We're up to something like 6,000.
So thank you for that.
And, yeah, we'll post to all 6,000 people a picture of your Arduino experiment
and send it to us.
So, yeah.
And then everyone will star your GitHub repository.
That's right. That's right.
That's right.
And then you can get the raise you've always wanted based on your GitHub repository.
All right.
Until next time.
See you later.
The intro music is Axo by Binar Pilot. Programming Throwdown is distributed under a Creative Commons Attribution Share Alike 2.0 license.
You're free to share, copy, distribute, transmit the work, to remix, adapt the work,
but you must provide attribution to Patrick and I and share alike in kind.