Camduino
Camduino is an interface to speak with Arduino over I2C.
 All Data Structures Files Functions Variables Enumerations Enumerator Macros
Data Structures | Macros | Enumerations | Functions | Variables
camduino.h File Reference
#include "i2c.h"

Go to the source code of this file.

Data Structures

struct  position
 

Macros

#define NO_DETECTED_OBJECT   31
 

Enumerations

enum  psensor {
  PSENSOR_A = 0x1, PSENSOR_B = 0x2, PSENSOR_C = 0x4, PSENSOR_D = 0x8,
  PSENSOR_E = 0x10
}
 

Functions

void init_camduino (int)
 
void get_ball_position (struct position *)
 
int object_detected ()
 
int get_pstate (enum psensor)
 

Variables

u8 i2c_data [I2C_PORT_N][I2C_DATA_N]
 
int arduino_port
 
int pstate = NO_DETECTED_OBJECT
 

Detailed Description

File description

Librairy to get some data from an Arduino over I2C. CMUcam4 must be connected on it and Arduino must run "CMU_Tracker_I2C" program, distance sensors must be connected to the board too.

Copyright

Trampoline is copyright (c) IRCCyN 2005-2014 Trampoline is protected by the French intellectual property law.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

File informations

Date
2014/07/18
Author
Benjamin Sientzoff
Version
0.1

Macro Definition Documentation

#define NO_DETECTED_OBJECT   31

state of (all) presence sensors when there is no object

Enumeration Type Documentation

enum psensor

list of presence sensors connected to the Arduino board

Enumerator
PSENSOR_A 

the first presence sensor on the left

PSENSOR_B 

the second presence sensor on the left

PSENSOR_C 

presence sensor on the middle

PSENSOR_D 

the second sensor of the right

PSENSOR_E 

the last sensor (on the right)

Function Documentation

void get_ball_position ( struct position ball)

Fill a position strucuture to get ball position

Fill a position strucuture to get ball position

Parameters
[in]ballA reference to the struct to fill
int get_pstate ( enum psensor  sensor)

get an given presence sensor state

Get an given presence sensor state

Parameters
[in]sensorName of the presence sensor to examine
[out]intstate of the sensor, return 0 if no detected object, else 1
void init_camduino ( int  i2c_port)

Initiate Arduino driver

Initiate Arduino driver, don't forget to call i2c_init() after. Set up i2c port, tram communication and power supply.

Parameters
[in]i2c_portNXT port where Arduino is connected
int object_detected ( )

Get global presence sensors state, consider the five sensors as one

Get global presence sensors state

Parameters
[out]intState of the presence sensors, equals to NO_DETECTED_OBJECT if an object is not detected, else return a different value

Variable Documentation

int arduino_port

NXT port connected to Arduino board

u8 i2c_data[I2C_PORT_N][I2C_DATA_N]

buffers storing I2C data

int pstate = NO_DETECTED_OBJECT

global state of presence sensors