NEX Robotics
3.6.5 Functions for Robot's sensors switching on / off
Using these function robots sensors can be switched on or off. Before using these functions,
make sure that Jumper 2, 3, 4 are open on the main board. For more details refer to the section
3.10, 3.11 and 3.12 0f the Hardware Manual.
Connections:
PORTG 2: Power control of Sharp IR Range sensor 2, 3, 4 and red LEDs of the white line
sensors
PORTH 2: Power control of Sharp IR Range sensor 1, 5
PORTH 3: Power control of IR Proximity sensors 1 to 8
Note: If Jumper 2, 3, 4 are open on the main board then setting logic 1 at the pin turns off the
corresponding set of sensors.
3.6.5.1 MOSFET_switch_config()
Sets direction of PORTG 2, PORTH 2 and PORTH 3 as output with initial value set to logic
0
void
MOSFET_switch_config (void)
{
DDRH = DDRH | 0x0C;
PORTH = PORTH & 0xF3;
DDRG = DDRG | 0x04;
PORTG = PORTG & 0xFB;
}
3.6.5.2 Functions for controlling power delivered to the sensors
void
turn_on_sharp234_wl (void)
//turn on Sharp IR range sensors 2, 3, 4 and white line sensor's red LED
{
PORTG = PORTG & 0xFB;
}
void
turn_off_sharp234_wl (void)
//turn off Sharp IR range sensors 2, 3, 4 and white line sensor's red LED
{
PORTG = PORTG | 0x04;
}
void
turn_on_sharp15 (void)
{
PORTH = PORTH & 0xFB;
}
void
turn_off_sharp15 (void)
{
PORTH = PORTH | 0x04;
}
www.nex-robotics.com
//make PORTH 3 and PORTH 1 pins as output
//set PORTH 3 and PORTH 1 pins to 0
//make PORTG 2 pin as output
//set PORTG 2 pin to 0
//turn on Sharp IR range sensors 1,5
//turn off Sharp IR range sensors 1,5
Fire Bird V Software Manual
61
Need help?
Do you have a question about the Fire Bird V ATMEGA2560 and is the answer not in the manual?