Comments: Getting Started with the RedBot

Pages

Comments 36 comments

  • I got this for christmas last year and just started to play around with it, I’ve ran into a bump though, whenever I upload the example it gives me this error: sketch_jun11a.ino:4:19: error: notes.h: No such file or directory sketch_jun11a:7: error: ‘RedBotMotors’ does not name a type sketch_jun11a.ino: In function ‘void loop()’: sketch_jun11a:118: error: ‘motors’ was not declared in this scope sketch_jun11a:147: error: ‘motors’ was not declared in this scope sketch_jun11a:151: error: ‘motors’ was not declared in this scope sketch_jun11a:157: error: ‘motors’ was not declared in this scope sketch_jun11a:163: error: ‘motors’ was not declared in this scope sketch_jun11a:167: error: ‘motors’ was not declared in this scope sketch_jun11a.ino: In function ‘void bump()’: sketch_jun11a:176: error: ‘motors’ was not declared in this scope sketch_jun11a.ino: In function ‘void horn()’: sketch_jun11a:187: error: ‘noteG5’ was not declared in this scope sketch_jun11a:189: error: ‘noteE5’ was not declared in this scope sketch_jun11a:191: error: ‘noteC5’ was not declared in this scope sketch_jun11a:197: error: ‘noteD5’ was not declared in this scope sketch_jun11a:201: error: ‘noteF5’ was not declared in this scope If you could get back to me quickly that would be preferable

    • Sounds like your libraries are not installed correctly. Check out the section on installing libraries, and I’ll forward your comment on to our techsupport team.

  • I seem to have a problem and I’m pretty sure I installed the library. sketch_jan03a.ino:5:19: error: notes.h: No such file or directory sketch_jan03a.ino: In function ‘void horn()’: sketch_jan03a:188: error: ‘noteG5’ was not declared in this scope sketch_jan03a:190: error: ‘noteE5’ was not declared in this scope sketch_jan03a:192: error: ‘noteC5’ was not declared in this scope sketch_jan03a:198: error: ‘noteD5’ was not declared in this scope sketch_jan03a:202: error: ‘noteF5’ was not declared in this scope

  • I am having trouble with the code listed below. My goal is to send a two-character command from the X-CTU app on my laptop that has an XBee connected to its USB port to my RedBot with an XBee installed. I have two Series 1 XBees and they are communicating with each other just fine. I see “RedBot waiting for command…” in my X-CTU terminal window when I press the reset button. When I type “st”, I see “Stop command received…”. Good so far.

    As soon as it executes a motor function, I get a “RedBot waiting for command…”, with the exception that motor.stop() seems to work as expected. If I enter “tr” (for turn right) or “tl” (for turn left), I don’t get the “Received turn right command…” or “Received turn left command…”. In the redbotForward() function I commented out the motor function and I get “Received forward command…”. If I un-comment the motor command, I get “RedBot waiting for command…” I can’t seem to figure out what the problem is. Anybody have any ideas?

    include <RedBot.h>

    RedBotMotor motor;

    define FWDSPD 175

    // Buffer to store incoming commands from serial port String inData = “”;

    void setup() { Serial.begin(9600); Serial.println(“RedBot waiting for command…”); }

    void loop() { while (Serial.available() > 0) { char charIn = Serial.read();

      if(charIn == 13) {
         if(inData == "gf") {
            redbotForward();
         } else if(inData == "st") {
            redbotStop();
         } else if(inData == "tr") {
            redbotTurnRight();
         } else if(inData == "tl") {
            redbotTurnLeft();
         } else {
            Serial.println("Command not recognized...");
         }
         inData = ""; // Clear received buffer
      } else {
         inData += charIn; 
      }
    

    } }

    void redbotStop() { Serial.println(“Received stop command…”); motor.stop(); }

    void redbotForward() { Serial.println(“Received forward command…”); // motor.drive(FWDSPD); }

    void redbotTurnRight() { Serial.println(“Received turn right command…”); motor.rightDrive(FWDSPD); }

    void redbotTurnLeft() { Serial.println(“Received turn left command…”); motor.leftDrive(FWDSPD); }

  • I got this error can anyone help, fast please. Library_Test:39: error: ‘RedBotMotor’ does not name a type Library_Test:43: error: ‘RedBotAccel’ does not name a type Library_Test:46: error: ‘RedBotEncoder’ does not name a type Library_Test:51: error: ‘RedBotSensor’ does not name a type Library_Test:52: error: ‘RedBotSensor’ does not name a type Library_Test:57: error: ‘RedBotBumper’ does not name a type Library_Test:58: error: ‘RedBotBumper’ does not name a type Library_Test:65: error: ‘RedBotSoftwareSerial’ does not name a type Library_Test.ino: In function ‘void setup()’: Library_Test:101: error: ‘swsp’ was not declared in this scope Library_Test.ino: In function ‘void loop()’: Library_Test:118: error: ‘xl’ was not declared in this scope Library_Test:130: error: ‘encoder’ was not declared in this scope Library_Test:130: error: ‘BOTH’ was not declared in this scope Library_Test:134: error: ‘swsp’ was not declared in this scope Library_Test:134: error: ‘encoder’ was not declared in this scope Library_Test:134: error: ‘RIGHT’ was not declared in this scope Library_Test:150: error: ‘motors’ was not declared in this scope Library_Test:179: error: ‘lSen’ was not declared in this scope Library_Test:179: error: ‘rSen’ was not declared in this scope Library_Test:179: error: ‘motors’ was not declared in this scope Library_Test:181: error: ‘rSen’ was not declared in this scope Library_Test:183: error: ‘motors’ was not declared in this scope Library_Test:187: error: ‘lSen’ was not declared in this scope Library_Test:189: error: ‘motors’ was not declared in this scope Library_Test:193: error: ‘lSen’ was not declared in this scope Library_Test:193: error: ‘rSen’ was not declared in this scope Library_Test:195: error: ‘motors’ was not declared in this scope Library_Test:199: error: ‘motors’ was not declared in this scope Library_Test.ino: In function ‘void bump()’: Library_Test:208: error: ‘motors’ was not declared in this scop

  • Hi, I was able to run the first example that simply drives the robot forward, stops a little and forward again. However I noticed the two motors do not rotate at the same speed, thus making the robot always turning to one side. Is there a way to fix this? Thank you in advance.

  • Hello, I downloaded and imported the RedBot-Master Library, but ran into the following error when compiling “redbot_first_robot” example:

    Shalls_first_robot:25: error: ‘RedBotMotor’ does not name a type Shalls_first_robot.ino: In function ‘void loop()’: Shalls_first_robot:41: error: ‘motor’ was not declared in this scope

    I’m pretty sure I have imported the library, it shows up at the bottom in the menu Sketch->ImportLibrary.

    Any suggestions? Thank you in advance.

    • Sounds like you have an extra folder in your path. The Arduino IDE will show any library embedded in any folder in the library path, but will only be able to use one that’s properly installed. Often downloading and unzipping leaves you with an extra folder. Make sure you don’t have an extra folder layer. If you are still having problems email techsupport@sparkfun.com with the full path of your library and they should be able to help.

  • hello im new at robotics and i would like some help. we are trying to get the redbot to move! im ten years old and every sketch i upload has errors. can anybody suggest anything?

  • Drive control code does not look right for Case #4.

    // Case 4: both sensors see dark

    Unless I am missing something (which is very possible), I think Case #4 should be moved up in front of Case #2. As it stands now, Case#4 will never be reached because at least Case 2 or 3 will be met first.

  • Drive control code does not look right for step #4. Unless I am missing something (which is very possible), I think Case #4 should be moved up in front of Case #2. As it stands now, Case#4 will never be reached because at least Case 2 or 3 will be met first.

    if (!bumped) { // Line following code: turn away from any sensor that is above the line // threshold. // Case 1: both white. Drive forward! if (lSen.read() < bgLevel && rSen.read() < bgLevel) motors.drive(100); // Case 2: right sensor is on black. Must recenter. if (rSen.read() > lineLevel) { motors.rightDrive(-100); motors.leftBrake(); } // Case 3: left sensor is on black. Must recenter. if (lSen.read() > lineLevel) { motors.leftDrive(-100); motors.rightBrake(); } // Case 4: both sensors see dark if (lSen.read() > lineLevel && rSen.read() >lineLevel) { motors.leftDrive(-100); motors.rightDrive(-100); } } else motors.brake();

  • The 404 error for https://github.com/sparkfun/RedBot/tree/master/Arduino/RedBot has returned!

  • How about adding a hall effect switch to the robot? We at UNB often use line following robots (following a black electrical tape) and embed a magnet at the end of the track. Detection of the magnet can be used to either inform the robot that it has reached a “dead end” of a maze or to actuate a motor or servo to perform a function. We use it to shoot a dart gun.

  • I get a 404 from https://github.com/sparkfun/RedBot/tree/master/Arduino/RedBot. https://github.com/sparkfun/RedBot works fine.

  • How can I connect Nintendo WII Nunchuk to RedBot?

    I can connect it to Arduino UNO. But RedBot is difficult. Anybody knows?

  • When I upload Demo program to a Rebot, I encountered an error.

    Binary sketch size: 5,814 bytes (of a 32,256 byte maximum) processing.app.SerialNotFoundException: Serial port ‘COM3’ not found. Did you select the right one from the Tools > Serial Port menu? at processing.app.Serial.<init>(Serial.java:191) at processing.app.Serial.<init>(Serial.java:77) at processing.app.debug.Uploader.flushSerialBuffer(Uploader.java:77) at processing.app.debug.AvrdudeUploader.uploadViaBootloader(AvrdudeUploader.java:175) at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:67) at processing.app.Sketch.upload(Sketch.java:1671) at processing.app.Sketch.exportApplet(Sketch.java:1627) at processing.app.Sketch.exportApplet(Sketch.java:1599) at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380) at java.lang.Thread.run(Thread.java:619)

    • Try resetting it… if that does not work unplug the arduino and the usb from your computer then reset the arduino 4-5 times and plug it back in a different usb port….. it happens to me a lot to.

  • First, thanks for a great kit; my 10-year-old son and I had a great time putting it together and getting it to do what we wanted. We’re still using it as yet another Arduino platform for experimenting.

    We found that we had to reverse the wiring on one of the motors to compensate for a possible misinstallation. The motors initially turned opposite each other; reversing the wire made them turn in sync. No problem.

    Most important for our success was the contrast of the surface and the line we asked the robot to follow. We started with the dark line inset in our wood flooring. Despite no end of variation on the dark level and motor speeds the RedBot would only go round in circles, presumably looking for a dark-enough line! We switched to black marker on off-white paper, then bluish-black paint on off-white paper with a little better result. The RedBot wanted to follow the lines but kept getting off track. Finally we settled on black electrical tape cut in half lengthwise on white foam board (the kind used in science fair posters) and the RedBot performed like a champ, hugging the lines with only occasionally having to spin around to relocate a line at a cross or triple point. A dark level of 120 and speeds of 115 and 125 for search and go made the Bot act like a bloodhound on a strong scent. Yay! It works!

    We have plans for this RedBot including adding a better bump response, some signal lights, and IR remote control. It’s a terrific platform for the budding (10-year-old) roboticist.

    • Thanks! I love hearing about people enjoying my stuff. Keep an eye on the website for future improvements, enhancements, tutorials, and sensors for the redbot platform.

      One thing I’ll say about the line followers: they’re an education in the difference between visible light and infrared light. Some things that are quite opaque in visible wavelengths are perfectly transparent in the infrared range. I found that trying to use a Sharpie on a white background doesn’t work at all–the Sharpie is transparent in infrared!

      Good luck, and have fun!

  • The line sensors don’t seem to want to follow the line. When I hooked the sketch up to Serial Monitor and printed out the values from the bot’s line sensor it get: rLevel = rSen.read(); lLevel = lSen.read(); cLevel = cSen.read();

    I get about 940 when there is no black line and it is just sitting on a white poster board. When I move the line sensor directly under a black sharpie line or black electrical tape, I about 980. This is true even when very close. If I put my figure over the sensor I get about 300. It seems like the sensor just isn’t giving much feedback when it is on a black line. Any help would be appreciated.

  • My robot just seems to be going straight and not detecting any lines. I’ve uploaded the sketch to the bot but I can’t seem to get it to work. Are there any other steps i’m missing? I’ve downloaded the library and uploaded the sketch to ‘Arduino Mini w/ATMega328’. Nothing seems to work for me

    • To test and refine; I put the chassis on it’s end so that it was sitting straight up. I put a piece of black masking tape on to a sheet of paper and moved it in front of the 3 sensors until I got the desired response from the motors.

      I do have to say, the instructions are a little thin on the ground. I may have put my robot together wrong.. I certainly broke some of the plastic because the tolerances are so tight. I had to modify the code to drive the motors in reverse, so that the sensors were at the front of the robot.

      Sparkfun: I had to refer to the product images to figure out half the build and wiring. Pictures are great, it would be awesome if there were more of them and bigger / more detailed. Thanks!

  • I have added the library correctly, however unsure what board to select from tools menu. I would have assumed the library would give me the RedBot board or similar, but i’m not seeing that anywhere. I tried a similar board with same chip (Uno) which appears to work uploading, but never runs or gives serial feedback.

  • Anyone having problems getting this to follow a line? I put a piece of cardboard down and took a marker and made a 10" circle with a black marker. It detects the line and starts to follow it, but it drive too fast to keep on the line. I’ve slowed it down as much as I could to keep above the stall voltage. Also one of the motor shafts is cracked. I didn’t notice it until I put it together, and it doesn’t seem to be affecting performance as far as I can tell.

    • Marker (for instance, a black Sharpie) is surprisingly transparent in the infrared. I spent a loooong time trying to get things working properly with black Sharpie on white foamcore, with no luck. I switched to black paint and, well, that’s what we shot the video with.

      My advice: get either a paint marker or a small tube of black acrylic paint. It makes a world of difference.

      As for the cracked shaft, if you find it gives you trouble, contact tech support and they’ll get you set up.

      • It definitely detects the marker, it just isn’t able to follow a circle about 10" in diameter and runs off it after a few seconds, if I aim it toward the circle it’ll start following it but only for a few seconds because it can’t turn quick enough. I was looking at the numbers of the sensors via the serial out and it always looked good. I guess I can try it again with acrylic paint.

        So far the cracked shaft isn’t causing problems (as far as I know), but I’d hate to have it all of the sudden fail some day.

  • I followed the instructions as you mentioned but there is still error

    Demo1:65: error: ‘followNoCal’ was not declared in this scope

    • You may not have the entire sketch downloaded. There are two files to the sketch, and both of them are needed to get the code to run.

  • when I uploaded Demo.ino into the mainboard of Redbot, there was error message,

    Demo:24: error: ‘RedBotMotor’ does not name a type Demo:29: error: ‘RedBotSensor’ does not name a type Demo:30: error: ‘RedBotSensor’ does not name a type Demo:31: error: ‘RedBotSensor’ does not name a type Demo:35: error: ‘RedBotAccel’ does not name a type Demo.ino: In function ‘void setup()’: Demo:49: error: ‘xl’ was not declared in this scope Demo.ino: In function ‘void loop()’: Demo:61: error: ‘xl’ was not declared in this scope Demo:65: error: ‘followNoCal’ was not declared in this scope

    Please explain how to solve it. Thanks.

    • It doesn’t sound like you have the library installed. download the library and follow the instructions here


If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!