Notifications
Clear all

Encoder with Servo Tutorial Error Code with sketch

8 Posts
3 Users
1 Reactions
930 Views
(@tckellogg)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

I am trying to use an encoder to run a servo with an Arduino uno card. I have loaded the sketch shown on the video from your tutorial and I get the error shown in the pictures below. I've checked it three times and every time I get the same error. Anyone know what I am doing wrong

IMG 3705
IMG 3704

 


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7115
 

Please use a screen grab, photos of screens is not usable. Also go into the IDE preferences and crank the compiler warnings to ALL.

BTW, how many years coding experience do you have, hobby or job?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7115
 

If you are new, here are some screen shots showing how to do what I asked.

Screen Shot 2022 06 05 at 10.45.05
Screen Shot 2022 06 05 at 10.45.30

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@tckellogg)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

@zander Unfortunately my programming experience is less than a week. I've mostly been taking courses and doing a few basic sketches. I made the changes you requested and here is the screen grab you requested.

2022 06 05

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7115
 

@tckellogg missing { after loop()

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2542
 

@tckellogg 

Your problem (this time) is that you are not using the brace brackets to properly contain the code associated with the subroutines.

In particular, this error derives from your code which is effectively ...

void loop() .... code body ...

whereas the code body for the loop sub must be placed inside brace brackets as ...

void loop() {.... code body ...}

In this case the compiler sees a bunch of code ranging around loose and so it cannot compile it properly.

 

You have created the setup code correctly, use the same form for loop and you'll be past this problem 

 

Anything seems possible when you don't know what you're talking about.


   
Ron reacted
ReplyQuote
(@tckellogg)
Member
Joined: 2 years ago
Posts: 10
Topic starter  

@will Thanks for the help. That fixed it. I can't take credit for the sketch. I was just copying and pasting


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7115
 

@tckellogg You are welcome. Here is a hint, use select all (cmd-a apple or ctrl-a win) on the original sketch so the copy paste doesn't miss any parts.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote