Hi, I have to improve Bittle with a infrared distance sensor, for a school project.
I pluged the sensor on the +5V, GND and A3.
I need to know in which file I have to write the code for adding the sensor.
Thanks for your help.
Clem, student from France
In src/io.h, add this line:
void readDistance() { int Leftdistance = 4800 / (analogRead(Leftsensor) - 20); //converting in centimeter int Rightdistance = 4800 / (analogRead(Rightsensor) - 20); if (0 < Leftdistance < 20) { strcpy(newCmd, "wkR"); token = T_SKILL; newCmdIdx = 5; } else if (Leftdistance > 60 or Leftdistance < 0) { strcpy(newCmd, "wkL"); token = T_SKILL; newCmdIdx = 5; } }
Could you help me please, could you write the begginig of the code.
Thanks
Hello, I come back to you because I've try to make the code and I think I'm bad for that. It doesn't work.
I've two infrared sensor, one for the left side, the other one for the right. The left sensor is pluged on A2, the right on A3.
the code in ultrasonic.h:
int Leftsensor=A2; int Rightsensor=A3; void loop() { int Leftdistance = 4800/(analogRead(Leftsensor)-20); //converting in centimeter int Rightdistance = 4800/(analogRead(Rightsensor)-20); if (0 < Leftdistance < 20){ strcpy(newCmd,"sit"); } else if (Leftdistance > 60 or Leftdistance < 0){ strcpy(newCmd,"sit"); } //same for the right side }
this code code doesn't work,
in addition I would like those instructions work only when Bittle walk forward
I hope you will help me
ok, used kcalib in serial monitor and recalibrated.. things seem good now..
ok, yes, I redownloaded the code with the change you made about 40 minutes ago and the odd behavior has been resolved. Now when I send the kzero command I do need to recalibrate. I am guessing there might be a bug where it does not go into calibration mode after saying yes to reset joint offsets. If there is another way please let me know... Thanks...
The code uploaded 24hours ago has a bug. So I uploaded a new one today. Please try it and redo the writing steps.
So I was able up upload everything just fine. During the first stage with #define MAIN_SKETCH commented out I get to "Reset joint offset?" at first I said no because I figure this would bring it into calibration mode. After I realized it does not go into calibration mode, but you are required to say yes in order for the skills to load.
The sounds and improvements on the Calibrate the IMU are great!
I go back and uncomment the main sketch but when it's done uploading Bittle jerks into an odd position, the front legs straight down and the read legs bent forward are a 90 degree angle at the lower joint. After any command I try results in very odd movement. My thought it maybe I need to recalibrate, but since saying yes at reset joint offsets doesn't go into calibration I'm not sure how to do it.
Any ideas on any of this?
Also, should we be updating things when Arduino says there are updates?
ok, I got it.. I started looking into the library directories and found when I tried to update some of the things to didn't replace what was there but rather added a 2 at the end of a second copy... verifies just fine now..
Thanks.
Yes, I am on 2.0. I used the link you provided above and was on branch 2.0. I switched the board to a few different options and tried to verify with each one, and then switched back to Uno and nothing changed.
BTW, you did download from the 2.0 branch, right?
It shows the *.o files have multiple definitions. Try select another board and compile, then switch back to UNO. It should clear up the cached files.
I just went in and renamed the Libraries director to Libraries-old. When I started Arduino it created a new empty Libraries directory, but the errors are still the same.
I included the needed libraries in OpenCat/src/ to simplify the configuration. I suggest you remove all the related libraries under your Documents/Arduino/Libraries.
As you can see it's not just one error but different ones. One thought, I did update the libraries and boards, if that could cause a problem..
Could you take screenshots of your error messages?
The compilation on my side shows no warnings, opposite to the previous massive warnings.
You may also pull the most recent code from GitHub. I fixed a few bugs these days.
I downloaded the new version. Renamed my OpenCat directory to OpenCat-old and replaced it with the new version. If I simply to verify I get tons of errors. I switched back to the old OpenCat and everything verifies just fine. Are there other changes that need to be made for the new version?
Hi, I just pushed a big update to the firmware to GitHub as the 2.0 version.
https://github.com/PetoiCamp/OpenCat/tree/2.0
New features are summarized here:
https://github.com/PetoiCamp/OpenCat/blob/2.0/ChangeLog.md#opencat20-is-pushed-to-the-branch-20-for-beta-testers
You can follow the process to setup:
https://github.com/PetoiCamp/OpenCat/tree/2.0#setup--process
In src/io.h, you can see how sensory data (for example, a voice sensor) can be incorporated into the workflow of the robot.