SENSORS
The Axon has a fairly large library for use with many different commercially
available sensors on the market. Usually to interface these sensors, all you need
to do is connect them to an Axon ADC pin (0-15). What the software library does
is convert the 8 bit return value to a more useful real-world value (meters, volts, amps, m/s^2, etc).
All sensor code, and full documentation with datasheets, may be found in sensors.c.
Below code are examples of how to get data from a particular sensor.
Note: I do not own some of the items below and wasn't able to test some of my code.
If you notice anything odd going on, send me an email.
Sharp IR Rangefinders:
range= sharp_IR_interpret_GP2D12(a2dConvert8bit(0));
range= sharp_IR_interpret_GP2Y0A02YK(a2dConvert8bit(0));
range= sharp_IR_interpret_GP2Y0A21YK(a2dConvert8bit(0));
range= sharp_IR_interpret_GP2D120(a2dConvert8bit(0));
range= sharp_IR_interpret_GP2D15(a2dConvert8bit(0));
Dimension Engineering Buffered 3D Accelerometer:
accel_x= accelerometer_ACCM3D(a2dConvert8bit(0));
accel_y= accelerometer_ACCM3D(a2dConvert8bit(1));
accel_z= accelerometer_ACCM3D(a2dConvert8bit(2));
Sparkfun SEN-00741 Breakout
accel_x= accelerometer_SEN00741(a2dConvert8bit(0));
accel_y= accelerometer_SEN00741(a2dConvert8bit(1));
accel_z= accelerometer_SEN00741(a2dConvert8bit(2));
rate_x= gyro_SEN00741(a2dConvert8bit(3));
rate_y= gyro_SEN00741(a2dConvert8bit(4));
MaxSonar
//analog mode
range= sonar_MaxSonar(a2dConvert8bit(0));
(beta) Ping Sonar
//requires timer0
range= sonar_Ping();
SRF05 Sonar
Please see the
SRF05 to Axon tutorial.
Phidgets
pressure= pressure_phidget(a2dConvert8bit(0));
voltage= voltage_phidget(a2dConvert8bit(0));
magnet= magnetic_phidget(a2dConvert8bit(0));
temp= temperature_phidget(a2dConvert8bit(0));
current= currentDC50_phidget(a2dConvert8bit(0));
current= currentAC50_phidget(a2dConvert8bit(0));
current= currentDC20_phidget(a2dConvert8bit(0));
current= currentAC20_phidget(a2dConvert8bit(0));
humidity= humidity_phidget(a2dConvert8bit(0));
MISC
Most misc programs are stored in misc.c
(see file for further documentation).
Control Sabertooth 2x5, 2x10, and 2x25 from Dimension Engineering by serial:
//send command to (motor 1, motor 2)
sabertooth(60,198);//default at UART2, 38400 baud
//swap back to your uart here
Control Syren 10, 20, and 25 from Dimension Engineering by serial:
//send command to (motor)
syren(198);//default at UART2, 38400 baud
//swap back to your uart here
Random Numbers
//sets random seed to current timer value
srandom(TCNT0);
//returns random number between 0 and 32767
random_number = rand();