minibloq line following and object retrieval

HI
I’m new to any form of programming but have been having great fun using minibloq. However, I’m having difficulty programming to follow the line maze and retrieve an object at the same time. The closest I have is Sparki moving forward by 3 scanning for the object and retrieving it then continuing with the maze, which is fine but when we reach the corners its really struggling to follow the line as every three seconds it is using the ultra sonic range finder instead of the line sensor…so it loses the line. If I program it to move forward at 0, once Sparki has retrieved the object it no longer detects the line as it gets caught in the loop of still detecting the object and trying to pick it up.
How can I program it so that once Sparki has picked up the object it no longer tries to detect an object?
Or is it just too complex for me and minibloq lol!
Sorry for the n00b question
hope you guys can help
Ash

Hi ahsbot,

Can you post an example of the program you are currently using?

Are you using the supplied poster, or one you printed yourself?

Hi thanks for your reply. I have edited the code a lot since then and have used a much simpler design on my own poster as initially I was using the supplied poster. I tried to attach some images below but it says they aren’t allowed. In this example the Sparki follows the line around the maze and at the corners scans for an object which it picks up before turning 90 and following a distance input instead of the line. This is because once it has picked up the object the sequence for line following doesn’t kick in and there isn’t a way to avoid the perpetual loop of trying to pick up the object it is already carrying. It then drops the object at the next intersection and can return to following the line and complete the maze. This way the robot can pick up and move two items on the maze. It seemed like a good compromise to me.

Hi ashbot,

Without seeing the program or the line maze, it would be pretty hard to help. If you’re having a hard time uploading the images to the board, can you email help@arcbotics.com?

I can post the code generated at the side of the page rather than the blocks of that makes sense hopefully…on the maze the object is placed after the first straight line before a 90 degree right turn and the strange line thing underneath almost a box is an example of the maze Iv been using…
____________
I____________I
I____________I
I_________

so what happens with the code below is that sparki follows the line but as soon as the object is detected it drives off the line and just keeps on going. If the object is removed the sparki goes back to following the line…but it never actually moves the grippers to pick up the object

void setup()
{
float threshold = 500;
float lineLeft = 0;
float lineCenter = 0;
float lineRight = 0;
while(true)
{
lineLeft = sparki.lineLeft();
lineCenter = sparki.lineCenter();
lineRight = sparki.lineRight();
sparki.servo(0);
sparki.RGB(0,255,0);
if((lineRight<threshold))
{
sparki.servo(0);
delay(4000);
if((sparki.ping()<=3))
{
delay(2000);
sparki.gripperClose();
delay(4000);
sparki.gripperStop();
delay(2000);
sparki.RGB(255,0,0);
sparki.beep(640, 1000);
if((lineLeft<threshold))
{
sparki.moveLeft(0);
}
else
{
}
if((lineRight<threshold))
{
sparki.moveRight(0);
}
else
{
}
if(((lineCenter<threshold)&&(lineLeft>threshold)&&(lineRight>threshold)))
{
sparki.moveForward(0);
}
else
{
}
}
else
{
if((lineRight<threshold))
{
sparki.moveRight(0);
}
else
{
}
if((lineLeft<threshold))
{
sparki.moveLeft(0);
}
else
{
}
if(((lineCenter<threshold)&&(lineLeft>threshold)&&(lineRight>threshold)))
{
sparki.moveForward(0);
}
else
{
}
}
}
else
{
if((lineLeft<threshold))
{
sparki.moveLeft(0);
sparki.RGB(0,0,255);
sparki.beep(340, 1000);
}
else
{
}
}
if(((lineCenter<threshold)&&(lineLeft>threshold)&&(lineRight>threshold)))
{
sparki.moveForward(0);
sparki.RGB(0,255,0);
}
else
{
}
delay(100);
}
}

void loop()
{
}

If this generated code is inputted the sparki picks up the object but every time it needs to turn right it then tries to pick up the object again, although it already has it which is why I ended up with the previous code as I thought if I told sparki to continue along the line it wouldn’t skip back to the beginning of the loop and keep trying to pick up the object.

void setup()
{
float threshold = 500;
float lineLeft = 0;
float lineCenter = 0;
float lineRight = 0;
while(true)
{
lineLeft = sparki.lineLeft();
lineCenter = sparki.lineCenter();
lineRight = sparki.lineRight();
sparki.servo(0);
sparki.RGB(0,255,0);
if((lineRight<threshold))
{
sparki.servo(0);
delay(4000);
if((sparki.ping()<=3))
{
delay(2000);
sparki.gripperClose();
delay(4000);
sparki.gripperStop();
delay(2000);
sparki.RGB(255,0,0);
sparki.beep(640, 1000);
}
else
{
if((lineRight<threshold))
{
sparki.moveRight(0);
}
else
{
}
if((lineLeft<threshold))
{
sparki.moveLeft(0);
}
else
{
}
if(((lineCenter<threshold)&&(lineLeft>threshold)&&(lineRight>threshold)))
{
sparki.moveForward(0);
}
else
{
}
}
}
else
{
if((lineLeft<threshold))
{
sparki.moveLeft(0);
sparki.RGB(0,0,255);
sparki.beep(340, 1000);
}
else
{
}
}
if(((lineCenter<threshold)&&(lineLeft>threshold)&&(lineRight>threshold)))
{
sparki.moveForward(0);
sparki.RGB(0,255,0);
}
else
{
}
delay(100);
}
}

void loop()
{
}

so yeah I’m stuck between one and the other and cant seem to figure out a middle ground…
If this is really awkward to understand please let me know and I will email.
I do have some very positive feedback for your educators section which I will update
Thanks
Ash

Hi Ash,

Yes, yes, an email would work better. Thanks!