roboapi package

roboapi

API for Atmega 2560 based robot control

class roboapi.Atmega(baudrate=9600)[source]

Bases: object

A Parent class for I/O port access

classmethod check_for_valid_pin_port(portname, pin_value)[source]

Check for valid pin numbers and port numbers raises Value Error if invalid

Parameters:
1.portname: str
Port Name given by the user
2.pin_value: integer
binary wieghted decimal representation of the pin numbers given by the user
classmethod config_register(Registername, Pins=[], set_pins=None)[source]
Accessing I/O ports of the controller
Sends a serial packet to the controller based on the input arguments
Parameters:
1.Registername = str
Name of the I/O Port
2.Pins = list
A comma separated list of I/O pin numbers
3.set_pins = Named Argument
The corresponding pin numbers set to logic ‘1’ when True; set to logic ‘0’ when False
Examples:
Port J access
>>> config_register('PortJ', Pins=[1, 2, 4], set_pins=True)
Port A access
>>> config_register('DDRA', Pins=[0,5,3,5], set_pins=False)
classmethod serial_write(data)[source]

send data on the serial port

class roboapi.Buzzer(baudrate)[source]

Bases: roboapi.Atmega

Derived class from parent class Atmega. Provides functions to control Buzzer

off()[source]

Turn OFF buzzer

Example:
>>> Buzzer.off()
on(on_time=0)[source]

Turn ON buzzer for a specified time

Parameters:
on_time = float
ON time in seconds
Examples:
>>> Buzzer.on(5) "5" is ON time in seconds
>>> Buzzer.on(0.3) "0.3" is ON time in seconds
class roboapi.Motion(baudrate)[source]

Bases: roboapi.Atmega

Derived class to control the motion of the robot

Description:
DC motors controlled by PortL pins 3,4 and PortA pins 0,1,2,3
back()[source]

Move the robot back

Example:
>>> Motion.back()
forward()[source]

Take the robot in forward direction

Example:
>>> Motion.forward()
left()[source]

Move the robot left

Example:
>>> Motion.left()
right()[source]

Move the robot right

Example:
>>> Motion.right()
soft_left()[source]

Small deviation in robot motion towards left

Example:
>>> Motion.soft_left()
soft_right()[source]

Small deviation in robot motion towards right

Example:
>>> Motion.soft_left()
stop()[source]

Stop the robot

Example:
>>> Motion.stop()

serial_connection

serial_connection.serial_open(baudrate)[source]

Searches all serially connected devices. List all devices recognized as ttyUSB* (for Linux)

serial_connection.serial_port_connection(port_detect)[source]

Function: Multiple serial devices may be connected to system. This function list down all connected serial ports and ask user to select a desired port

Parameters:

1.port_detect = list
list of all serial ports detected
2.baudrate = Named Argument
Baudrate for serial communication