After struggling mightily with the sketch compiler I have managed to compile and upload the new libraries.
I have new shield, the new IR receiver, new batteries in both remote and bot as well a new 6 wire cable hooked up.
The IR receiver is plugged into port 6 and all of the lights are on. When I push the remote buttons I can see the blue LEDs by the motor plugs light up; LEFT ARROW lights up bottom LED, RIGHT ARROW lights up top LED and DOWN ARROW lights up both.However TOP ARROW does not light either, but I suspect that may be normal. No light from number buttons for speed. FYI I had the old shield and IR receiver working yesterday, so the components (motors/board/shield) are operable. I tried changing the port from 6 to 3 as suggested other post but it did not work. I may not have done it correctly or completely (changed 6 to 3 in
MeInfraredReceiver infraredReceiverDecode(PORT_3);
compiled and uploaded it, no lights when IR is pushed, however swapping the cable back to 6 gives me LEDS again.
What am I missing?
IR bot does not run
I have also discovered that the sketch will not upload with the board selected as Leonardo it gives me the following error;
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "Arduino Leonardo"
Binary sketch size: 11,438 bytes (of a 28,672 byte maximum)
Found programmer: Id = “B«J”; type =
it also suggest "maybe it isnt a butterfly/AVR109 but a AVR109 device
It will upload and I can change the ports if I select UNO as the board.
I made some progress through trial and error.
tried every port and finally got some response from port 7, however all of the controls are reversed and backwards
(forward turns right, right goes forward, backwards turns left and left goes backwards)
changed the commands in the sketch and it works now, but still puzzled.
All of this was done as Uno board as well, Leonardo still no go.
I finally figured out what was going on with my IR bot. The documentation is really, really bad. The board is not shipped with the correct software. That software is intended for the Mbot. It flat out doesn’t run. Through a lot of trial and error, I found out that the board is an Orion. I made my own Scratch files to test out the motors, the IR control and the Ultrasound sensor. I will post them. I got a lot of help from reading the posts of other users. My sketch is a little bass-ackwards. For some reason I was able to get my motors running with a different wiring configuration than I am using now, and I had to adapt the sketch to some unconventional uses, such as setting M1 to -255 and M2 to 255 for flat out full speed ahead. I will have to uncross wires to rectify this.
This code was created from Scratch, but should run in the Arduino Interface as an Orion or Uno/Genuino Uno on the Arduino side. Another issue was to find the correct keys for the IR interface. The Keycodes come from the mBot, which is another issue of the Starter Kit. Don’t get me started!
#include <Arduino.h>
#include <Wire.h>
#include <Servo.h>
#include <SoftwareSerial.h>
#include <MeOrion.h>
double angle_rad = PI/180.0;
double angle_deg = 180.0/PI;
MeDCMotor motor_9(9);
MeDCMotor motor_10(10);
MeInfraredReceiver ir_6(6);
MeUltrasonicSensor ultrasonic_3(3);
void setup(){
ir_6.begin();
motor_9.run(-100);
motor_10.run(-100);
}
void loop(){
if(((ir_6.getCode())==(69))){
motor_9.run(0);
motor_10.run(0);
}
if(((ir_6.getCode())==(70))){
motor_9.run(-255);
motor_10.run(255);
}
if(((ir_6.getCode())==( 7 ))){
motor_9.run(-100);
motor_10.run(100);
}
if(((ir_6.getCode())==(9))){
motor_9.run(100);
motor_10.run(-100);
}
if(((ir_6.getCode())==(25))){
motor_9.run(255);
motor_10.run(-255);
}
if((ultrasonic_3.distanceCm()) < (30)){
while(!((ultrasonic_3.distanceCm()) > (40)))
{
motor_9.run(50);
motor_10.run(-50);
}
}
ir_6.loop();
}