Modules | Enumerations | Functions

Functions which handle the Robot ID. More...

Modules

 Advanced informations
 

Enumerations

enum  eRobotId
 clusters the robot IDs More...
 

Functions

eRobotId robotId_get (void)
 Returns the robot on which the current program is running. More...
 

Detailed Description

Functions which handle the Robot ID.

All robots within the lab are constructed and built the same way. Therefore, it is a good assumption that they also have euqal properties. However, for finetuning the sensors measurements and the behaviour, it might be a helpful to distinguish the different robots.

This module provides a function, which returns on what robot it is running.

Internally a unique string is stored within the EEPROM of the microcontroller.

example

/*******************************************************************************
* examples/robotIdSimple.c *
* ======================== *
* *
* Version: 1.0.0 *
* Date : 13.11.17 *
* Author : Peter Weissig *
* *
*******************************************************************************/
//*********************************<Included files>*****************************
#include <tucbot/tucbot.h>
//*********************************<Methods>************************************
void testRobotId(void);
int main(void);
//*********************************[testRobotId]********************************
void testRobotId(void) {
enum eRobotId id;
const char *address;
lcdclr();
lcdstr_p(PSTR("Robot ID" ));
lcdxy(0,1);
lcdstr_p(PSTR("#### <u> "));
while (1) {
mdelay(100);
id = robotId_get();
address = tucbot_robotId_getString(id);
if (address != 0x0000) {
lcdxy(0,1);
lcdstr_p(address);
}
}
}
}
//*********************************[main]***************************************
int main (void) {
init_tucbot(0xFF);
testRobotId();
return (0);
}

Enumeration Type Documentation

◆ eRobotId

enum eRobotId

clusters the robot IDs

See also
robotId_get()
Enumerator
kRobotIdNone 

constant (0x00): robot without ID

kRobotIdAndi 

constant (0x0A): robot ID of Andi

kRobotIdAnni 

constant (0x0B): robot ID of Anni

kRobotIdEmmi 

constant (0x0C): robot ID of Emmi

kRobotIdHugo 

constant (0x0D): robot ID of Hugo

kRobotIdPete 

constant (0x0E): robot ID of Pete

kRobotIdError 

constant (0xFF): error reading robot ID

Function Documentation

◆ robotId_get()

eRobotId robotId_get ( void  )

Returns the robot on which the current program is running.

This function checks the EEPROM for a unique identifier. If set, it will return the corresponding robot ID.

Note
The unique string will be stored at the end of EEPROM.
Returns
value representing the current robot ID - see also eRobotId
See also
tucbot_robotID_getXbee()
leds_set
void leds_set(eLedMask bitmask, uint8_t bool)
Sets the selected leds on or off.
buttons_get
eButtonMask buttons_get(eButtonMask bitmask)
Returns the last stored value of the selected buttons.
tucbot_robotId_getString
const char * tucbot_robotId_getString(eRobotId id)
Returns a pointer to the unique robot ID string located in the flash.
kLedOn
@ kLedOn
constant (0xFF): turn leds on
Definition: leds.h:63
kLedRight
@ kLedRight
bit mask (0x04): right led
Definition: leds.h:46
kButtonRight
@ kButtonRight
bit mask (0x10): right button
Definition: buttons.h:37
buttons_request
void buttons_request(eRequestType request)
Requests new data from the buttons.
kRequestContinuous
@ kRequestContinuous
constant (3): request continuous updates
Definition: update.h:37
kLedOff
@ kLedOff
constant (0x00): turn leds off
Definition: leds.h:61
lcdclr
void lcdclr(void)
Clears the display.
lcdxy
void lcdxy(uint8_t x, uint8_t y)
Moves the cursor to a postion on the display.
eRobotId
eRobotId
clusters the robot IDs
Definition: robotId.h:28
lcdstr_p
void lcdstr_p(const char *send_data)
Writes a string located in the flash to the display.
init_tucbot
void init_tucbot(uint8_t enable_interrupts)
Initiates the TUC-Bot.
mdelay
void mdelay(uint16_t mseconds)
Waits for the given time in milliseconds.
robotId_get
eRobotId robotId_get(void)
Returns the robot on which the current program is running.