element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum EASY -> Arduino Robot (line following / rescue) gone wrong :(
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 9 replies
  • Answers 6 answers
  • Subscribers 393 subscribers
  • Views 817 views
  • Users 0 members are here
  • arduino 101
  • arduino-robot
  • robotics
  • help!!
  • education help
  • robot kit
  • help!
Related

EASY -> Arduino Robot (line following / rescue) gone wrong :(

the_future
the_future over 8 years ago

Hey guys!

 

Need help! I get this message "Low memory available, stability problems may occur."

then the robot will search for a line but then struggles to follow the path.

 

 

 

CODE from example:

 

/* Robot Rescue

 

 

In this example, the robot enters the line following mode and

plays some music until it reaches its target. Once it finds the

target, it pushes it out of the track. It then returns to the

track and looks for a second target.

 

 

You can make the robot push as many objects as you want to, just

add more to calls to the rescue function or even move that code

into the loop.

 

 

Circuit:

* Arduino Robot

* some objects for the robot to push

* a line-following circuit

 

 

created 1 May 2013

by X. Yang

modified 12 May 2013

by D. Cuartielles

 

 

This example is in the public domain

*/

 

 

#include <ArduinoRobot.h> // include the robot library

#include <Wire.h>

#include <SPI.h>

 

 

void setup() {

  // initialize the Robot, SD card, display, and speaker

  Robot.begin();

  Robot.beginTFT();

  Robot.beginSD();

  Robot.beginSpeaker();

 

 

  // draw "lg0.bmp" and "lg1.bmp" on the screen

  Robot.displayLogos();

 

 

  // display the line following instructional image from the SD card

  Robot.drawBMP("lf.bmp", 0, 0);

 

 

  // play the chase music file

  Robot.playFile("chase.sqm");

 

 

  // add the instructions

  Robot.text("Rescue\n\n place the robot on\n the rescue track\n pushing the\n obstacles away", 5, 5);

  Robot.text("Press the middle\n button to start...", 5, 61);

  Robot.waitContinue();

 

 

  // start

  Robot.fill(255, 255, 255);

  Robot.stroke(255, 255, 255);

  Robot.rect(0, 0, 128, 80); // erase the previous text

  Robot.stroke(0, 0, 0);

  Robot.text("Start", 5, 5);

 

 

  // use this to calibrate the line following algorithm

  // uncomment one or the other to see the different behaviors of the robot

  // Robot.lineFollowConfig(14, 9, 50, 10);

  Robot.lineFollowConfig(11, 7, 60, 5);

 

 

  // run the rescue sequence

  rescueSequence();

  // find the track again

  goToNext();

  // run the rescue sequence a second time

  rescueSequence();

 

  // here you could go on ...

 

 

}

 

 

void loop() {

  //nothing here, the program only runs once.

}

 

 

// run the sequence

void rescueSequence() {

  //set the motor board into line-follow mode

  Robot.setMode(MODE_LINE_FOLLOW);

 

 

  while (!Robot.isActionDone()) { // wait until it is no longer following the line

  }

  delay(1000);

 

 

  // do the rescue operation

  doRescue();

  delay(1000);

}

 

 

void doRescue() {

  // Reached the endline, engage the target

  Robot.motorsWrite(200, 200);

  delay(250);

  Robot.motorsStop();

  delay(1000);

 

 

  // Turn the robot

  Robot.turn(90);

  Robot.motorsStop();

  delay(1000);

 

 

  // Move forward

  Robot.motorsWrite(200, 200);

  delay(500);

  Robot.motorsStop();

  delay(1000);

 

 

  // move backwards, leave the target

  Robot.motorsWrite(-200, -200);

  delay(500);

  Robot.motorsStop();

}

 

 

void goToNext() {

  // Turn the robot

  Robot.turn(-90);

  Robot.motorsStop();

  delay(1000);

}

  • Sign in to reply
  • Cancel

Top Replies

  • Robert Peter Oakes
    Robert Peter Oakes over 8 years ago +1 suggested
    I assume your using an Arduino UNO for this or at least an ATMEGA328 based controller It is a classic memory hog when you add SD card libraries and the like, you also have sound and graphics on the go…
  • Robert Peter Oakes
    Robert Peter Oakes over 8 years ago in reply to Robert Peter Oakes +1 suggested
    so remove things like Robot.beginSD(); Robot.beginSpeaker(); and the graphics cosmetics like // draw "lg0.bmp" and "lg1.bmp" on the screen Robot.displayLogos(); // display the line following instructional…
  • Robert Peter Oakes
    Robert Peter Oakes over 8 years ago in reply to Robert Peter Oakes +1 suggested
    I missed one, also remove this // play the chase music file Robot.playFile("chase.sqm");
Parents
  • clem57
    0 clem57 over 8 years ago

    Maybe looking at these steps may help Basic Line following Robot with Arduino - All

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • the_future
    0 the_future over 8 years ago in reply to clem57

    thanks will check it out! image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • the_future
    0 the_future over 8 years ago in reply to clem57

    thanks will check it out! image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube