Notifications
Clear all

Tf luna lidar with servo motor

24 Posts
6 Users
7 Likes
652 Views
ss
 ss
(@ss)
Active Member
Joined: 11 months ago
Posts: 14
Topic starter  

@robotbuilder It's actually for my university project and I am using a breadboard power supply module 3.3 V/5V

 


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 8 months ago
Posts: 966
 

No one is going to be able to test it unless you supply ALL the details...

  • specify ALL pieces - Googling your lidar, shows multiple versions
  • specs of your servo
  • which MPU
  • how you have wired it.  Show schematic or picture of your wiring

You've given us nothing to go on.  Besides... very few, if anyone here is going to have all the pieces to test if FOR you.

You did not verify the issue (MPU pins and timers) I suggested.  You will also find, not many here will do your school work for you.  They may help lead you to the answer, but they will not want to GIVE you the answer.  

I haven't looked at your code... but I hate looking at K&R formatting.  Won't do it anymore! 😉 Besides from the comments of others, I see you're expecting us to wire and code your project for you.  

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3462
 

@maheen Change the pins being used as that is a possible source of trouble. 

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3462
 

@maheen What do you mean it's a bit urgent?

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3462
 

@inq I am intrigued by your comment

 but I hate looking at K&R formatting.  Won't do it anymore

I too am often challenged by how code is formatted, can you share your style?

 

 

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3462
 

@inq I am happy to wire and code his project, but then I get the degree. It sounds like the plagiarism detection system doesn't work for code and wiring.

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 8 months ago
Posts: 966
 
Posted by: @zander

@inq I am intrigued by your comment

 but I hate looking at K&R formatting.  Won't do it anymore

I too am often challenged by how code is formatted, can you share your style? 

I don't recall which stated it, but one of K&R later wrote they had done a great disservice to coding style in the formatting of putting opening curly braces at the end of the line.  He stated, "We only did it to save line count, and thus page count to save book publishing cost!"

The only difference, I do... is always indent consistently and having paired braces in the same column and line count be damned.  I also use Hungarian notation and Camel Case for variable names in my libraries since I expect I have to debug, fix, modify them over long periods of time.  Once you've looked at your own code that is even 6 month old, and say, "WTF was I thinking?" a time or two, you'll get far more verbose with the variable names and comments.

void setup()
{
    if (<is Gonzo here?>)
    {
        <do something about Gonzo>
    }
}
        

We have had two threads since I've been here (3 months) that were about coding problems simply because they had lost count of their paired braces.  Having them in the same column solves that at a glance AND shows you exactly where you're missing one... if they indented properly.

I recognize that the K&R formatting disciples are just as religious about their opinion, but I'm set in my ways and retired so don't have to translate K&R style if I don't want to. 

I'd be more helpful and tolerant of someone here who has a good reputation, instead of having the "fix my code for me" mentality.

I'll get off my soap-box now.  End of sermon according to Inq 🤣 

 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3462
 

@inq As a former long time debugger of other people's code I completely understand. I do not agree with the amount of indentation though, 2 spaces is adequate. As far as {} goes and matching them up, both IDE 1 and 2 have code folding, 2 by default IIRC, but in 1 you have to turn it on. That feature is both helpful in hiding code you already 'know' and almost debugging the mismatched {}. I discovered yesterday that } else { produces different results re folding than 

}

else {

My problem is I grew up on PL1 so the formatting was like you do, and when I switched to C I didn't have a clear choice and still don't. Part of the problem is the screen. As you no doubt know the screen is oriented the wrong way UNLESS you display 2 up. The problem is I use a laptop and have 80 yr old eyes so 2 up is a challenge. 

Therefore for all the above reasons (folding, screen size) I have been using the trailing { and if I am working with someones code from here the first thing I do is an autoformat. It helps but not perfect. 

What drives me totally around the bend though is somebody using {} on a single line of code using your style, now 4 lines of the available 30 is used instead of just 1.

HOWEVER, this is not a workplace and I am not the setter of standards so everyone can do whatever they like. Just know I have and will continue to pass on looking at code that is badly styled.

YMMV

 

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
frogandtoad
(@frogandtoad)
Noble Member
Joined: 3 years ago
Posts: 1484
 

@zander

Posted by: @zander

What drives me totally around the bend though is somebody using {} on a single line of code using your style, now 4 lines of the available 30 is used instead of just 1.

I hate that too... it's a POX on the unsaid coding standards!

 


   
Ron reacted
ReplyQuote
Page 2 / 2