Buy an Axon, Axon II, or Axon Mote and build a great robot, while helping to support SoR.
0 Members and 1 Guest are viewing this topic.
#include "sys\axon2.h"#include "led.h"#include "rprintf.h"#include "hardware2.h"#include "a2d.h"#include "C:\My_Robot\WebbotLib\Sensors\Distance\Sharp\GP2.h"#include "C:\My_Robot\WebbotLib\Sensors\Distance\Devantech\SRF05_Sonar.h"#include "math.h"#include "rprintf.h"#include "C:\My_Robot\WebbotLib\servos.h"#include "Servos/Devantech/SD21.h"#include "C:\My_Robot\WebbotLib\Sensors\Temperature\Devantech\TPA81.h"#include "Sensors/Compass/Devantech/CMPS03.h"#define RPRINTF_FLOAT#define RPRINTF_COMPLEXuint8_t led_value;Devantech_TPA81 tpa=MAKE_Devantech_TPA81_At(0xD0);CMPS03_I2C cmps03=MAKE_CMPS03_I2C_At(0xC0);Sharp_GP2D12 sharp = MAKE_Sharp_GP2D12(ADC0);void appInitHardware(void){ uartInit(USB_UART, USB_BAUD); rprintfInit(USB_ACTIVATE); distanceInit(sharp); compassInit(cmps03); temperatureInit(tpa); }TICK_COUNT appInitSoftware(TICK_COUNT loopStart){ rprintf("\nAxon initiated.\n\n"); return 0;}/TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){ compassRead(cmps03); rprintf("CMPS03 = %d\n",cmps03.compass.bearingDegrees); distanceRead(sharp); delay_ms(70); led_value=interpolate(sharp.distance.cm,0,30,0,9);//stretch value for LED display led_put_char(led_value); temperatureRead(tpa); distanceDump(sharp); rprintf("\n%d", sharp.distance.cm); rprintf("\nmine %d",(long int)(1384.4*pow(a2dConvert8bit(ADC_NUMBER_TO_CHANNEL(0)),-.9988))); rprintf("\n"); rprintf("\nTemperature: "); rprintf("\n%d", tpa.temperature.celsius); rprintf("\n%d", tpa.sensor[0]); rprintf("\n%d", tpa.sensor[1]); rprintf("\n%d", tpa.sensor[2]); rprintf("\n%d", tpa.sensor[3]); rprintf("\n%d", tpa.sensor[4]); rprintf("\n%d", tpa.sensor[5]); rprintf("\n%d", tpa.sensor[6]); rprintf("\n%d", tpa.sensor[7]); rprintf("\n"); return 20000;}
This is a 'feature' of WebbotLib.
Quote from: Admin on August 31, 2010, 04:45:36 PMThis is a 'feature' of WebbotLib.Hehe, we have many of these 'features' in the million $ robots I use at work. There should at least be a flashy error message. I have always like the flashy error messages for when i messed something up. I though "Can't read sensor" would at least be in there as well. Commence rock slinging.
Thanks Admin,I tried the two sensors one at a time, the compass is working fine, but the TPA gives me 0s. I tested the TPA with the Devantech's USB-ISC module directly connected tomy computer and it works fine, so no damaged TPA81.I also changed the wires, but no luck, so I'm out of any solutions at the moment.Theo
The library already said 'it aint working' via an error return.
That's acceptable. Admin made it sound like it did nothing and just locked up.
But storing all these text debug messages eats up program space - and for a 'working board' will never be used.So on the one hand I have people asking if WebbotLib can work on an ATtiny with 4kb and on the other people asking if it can emit enough debug info to solve their soldering problems!
I also had the idea of having a 'debug.h'
Quote from: teoxan on August 31, 2010, 04:56:59 PMCan you send me your source code - including any H files. Not sure if you are using Project Designer or not?