have you ever had compile and upload
errors in your Arduino sketch and didn't
know where to find the problem I'm gonna
show you how to find it I'm Tom Kvichak
and this is Toms Trains and Things
this channel was created to help other
modelers who are in need of guidance in
pursuing our dream of building a model
railroad and if you're using Arduino to
automate your model railroad and you run
into problems with compiling and
uploading your sketch I do also and I'll
show you what I run into and I'll show
you how you could find your issues in
your sketch it's not that hard 
Arduino gives you the error message and
it points right to the line that the
problem is at so let's take a look at
the issues that I had in the last lesson
lesson eight of Arduino made easy and
what I did to correct it so let's see if
this thing compiles ok I'll click on
that right there
and we'll sit and wait and see if it
compiles and hopefully it will led1 was
not declared in this scope of capin mode
LED void setup in mode LED one two three
four what do I have okay led-100 forgot
the bees in here so nobody reminded me
to not forget to be so I'm gonna have to
change it in all of those and then we'll
see if this thing will compile
okay
glowpin was not okay glowpin analog
Writet glowpin G-L-O-W-P-I-N how
did i spelling up here G-L-O-W-P-I -N
ledglowpin  okay
that's what it is okay I spelt that
wrong so there should be another one in
here with a glow pin and I wrote okay
void welder that's a shutdown as a
welder glow pin this should be LED glow
pin and that one should make it good
right there so this is what you go
through and this actually finds your
mistakes in here glow pin was not
declared so there's another one more
than the other one up here L-E-D-B-1  glow pin there's the other one I
could have done a ctrl F to find every
instance of glow pin
okay glow pin there's another one glow
pin
you know probably what I did was put LED
glow pin in one of them and it shouldn't
have so having to change it everywhere
where it says glow pin digital read nine
okay there all right
this is a good way to find all your
mistakes in here welder count was not
declared okay W-E-L-D-E-R-C-O-U-N-T misspell it
 okay a weld count okay so it's
called weld count okay now this time
delay was not declared in his delay
spelled it wrong
that's my fingers going faster than they
they want to so let's see D-I-G-I-T-A-L
W-R-I-G-H-T w RI ght we're all right okay 
W-R-I-T-E  i use the wrong right in
there okay so now
is there gonna be any more mistakes
let's see digitalWright again I did
it oh yeah I copied so the first one was
wrong is it right or is it wrong yeah
you know is there any more okay
hopefully that's the last one because
this could take forever I should have
went through and as I went through you
know about four or five lines then
compiled and then cut the mistakes
before they got too drastic it's still
compiling let's see if we yeah that's a
good sign the skin a little bit further
now so it might be working this time
we'll see I think we got a good one here
it's compiling it skills still compiling
if it's not doing anything and you don't
see any error messages popping up that
means it's going through there and
changing it into machine language and
there we go it's it's done it's done
compiling so it works it works now so
what we're gonna do now is we're gonna
get rid of all these spaces here in
between all that stuff right there okay
we'll get rid of that space get rid of
this space we really don't need all
these spaces in here between the
alright ok we got those curly braces in
there okay so now let's go through this
now we're going through the loop so if
digital read sensor one eco loan as we
cover up the sensor and sequence started
equals zero then we're going to start
this thing so let me plug this thing in
and it's already got the sketch in there
but when I did this over again I J I
changed some of the spelling on it
nothing the last time it was the the my
original one that I did I called it just
glow pin not LED glow pin but somewhere
in here I added LED glow bin so I ended
up changing all of them to LED glow pin
so that's alright so we're going to
upload it it'll compile it again Error
compiling the board Arduino genuine UNO
let me see did it pick up the
com port yeah genuine UNO okay
we'll try it again
sometimes it just doesn't work or
doesn't want to cooperate so we've got
this error compiling the board Arduino
genuine UNO
just standing there ID returned one exit
status okay this happens every time I do
a lesson every time I can go here and
upload sketches all day long and nothing
happens but soon as I go and record for
a lesson it'll mess up so let me go off
camera and figure this out well after
going through that I finally decided to
shut the sketch off and open it back up
and finally upload it so I'll go through
the stuff with uploading it again it
just just didn't recognize the sketch at
all and that's what no it did it again
it just did it again
okay now we'll go over here permission
denied no that did the same thing but
right after I did it I uploaded it it
took the upload and now that I have it
recording it doesn't read it doesn't do
it this is weird
compile it
like I would compiled it every other
time see and it's not working now now
I'll go over and I'll shut this off
let me close this out open up Arduino
again
this one here
lets open this up a little further
and we'll upload it and see what happens
it's compiling and it's going through
all the lines and I have it to where it
gives us a report of what what it goes
through whenever you have an error
message it's a good idea to go into
preferences and check off the verbose
settings on there so it'll give you all
the information down on the bottom
whenever you have an issues like I'm
having here a good thing to do is go
into your preferences and click on these
show verbose output during compilation
and upload what I do is click on both of
them and that'll give you infer that
will give you a little bit more
information that you could read to find
out where your issue is I was able to
find my issue in a lot of my problems
and it seems like every time that I
record is the only time that I have this
so it must be I record with OBS so it
must OBS must interfere with it somehow
so I'll show you this I'll go through
the compilation and you could see the
information that comes up you don't
normally see this unless you click on
that verbose and it shows you all the
steps that it goes through so you could
troubleshoot if you have a problem and
this is the one good thing about it and
this is what I do whenever I have an
issue and I can go back and see in red
what the issue is and then there a
couple of other episodes of Arduino made
easy there was an update for the arduino
ide
and i did it right before that and
somehow it deleted some files and that's
how I found how what files were missing
so archiving build core caching that's
normal you'll see that towards the end
and then this is how it looks and if you
have any problems it'll show up red like
this this is norm
you'll have one line of red and
everything but if there's a problem
it'll show you the problem like it like
it showed you in the earlier in the
video so that's what I use and that you
go up to preferences and if you're
finished with it you can uncheck it and
that way you know you won't get all
those lines down on the bottom over
there like that and we'll just put that
back down another thing that I want to
show you that I added after I did the
video but it's up on my webpage I added
this line here random scene red that
random seed analog reads ero and what
that'll do is if you take out these two
right there that uncomment it and it
will change the randomness because in in
all of these randoms it's it it's not
actually random it's a pseudo random it
picks random numbers but it's the same
numbers every time so if you go up to
the random seed it reads the analog pin
zero and it's not it and if you don't
have anything plugged into it it's not
always set at zero it fluctuates and
it'll give random readings in there
anywhere from 0 to 1023 so that will
change the the random sequence in these
random numbers over here so if you're if
you're doing it and you start it up and
you see a pattern you'll have a
different pattern each time instead of
having the same pattern every time you
start now back to our original video you
can see the information on the bottom
scrolling through there with all that it
is recording
still going linking everything okay now
it's uploading so you see done uploading
all right now let's go over to this
camera right here and you'll see that we
cover this up and we get the sequence
starting with the four LEDs and the
building light and then this starts you
get the white and the blue flashing and
then the red one
it starts out bright and then it starts
to dim that's all we have for now and
we're going to be working on some sound
files in the future so take a look for
that and we'll see Ya
