Go Down

Topic: Boe-bot for arduino roaming with ping on servo turret (Read 3 times) previous topic - next topic

S_Flex

#10
Feb 12, 2013, 07:00 pm Last Edit: Feb 12, 2013, 07:05 pm by S_Flex Reason: 1

Quote
It also made me wonder how delay() would handle a negative number or if it defaults to one or zero.

The argument to delay() is an unsigned long. You need to determine for yourself what -1 as an unsigned long looks like. It will mean a lot more to you if you figure that out that if we tell you.

A hint, though. No, it does not cause delay() to think that you meant 0 or 1, not be a long shot. (Or an unsigned long shot).


Either Im going blind or the banks should start storing everyone's negative debt in an unsigned long.

UKHeliBob



You need some rotation sensors so that you can compare the rotational speed of the wheels and adjust the speed of the motors accordingly.  There are even clever ways to do it with only one rotation sensor but it would be easy to do it with two.


Can you tell me what rotation sensors would be good enough, easy to get and and fairly cheap?

I can't recommend a particular one but Google will find you plenty, or ask in the Robotics section of this forum for more specific advice.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

PaulS

What value is in a byte (unsigned) when you try to store -1 in it?
What value is in an int (unsigned) when you try to store -1 in it?
What value is in a long (unsigned) when you try to store -1 in it?

Write a sketch to find out.

S_Flex


What value is in a byte (unsigned) when you try to store -1 in it?
What value is in an int (unsigned) when you try to store -1 in it?
What value is in a long (unsigned) when you try to store -1 in it?

Write a sketch to find out.


1) error: invalid combination of multiple type-specifiers
2) 65,535
3) 4,294,967,295

I maybe wrong on the exact number for three and two because I didnt have time to copy it. I sure didnt think it would return the highest number it can hold...

well seeing that makes truely think the boe-bot sketch is broke and its not a hardware issue.

PaulS

Quote
I sure didnt think it would return the highest number it can hold...

Which is why delay(-1) is not a good idea. That will take a few weeks to complete.

Go Up