ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thank you for your answers! I found a possible solution. As there would be no need for two way communication and no ROS on the arduino all i needed to do was basically pass three integers over the serial port. Turned out there was a much simpler way to do that, simply by importing the "Serial" library in the python script in ROS.

The transmitting end in python(ROS):

import serial

import time

arduino = serial.Serial(dev/ttyUSB0, 115200, timeout = 1)

time.sleep(2)

arduino.write(integer)

Receiving end on arduino:

if (Serial.available() > 0) {

Serial.read();

integer = Serial.parseInt();

}

Hope this can help others in the future.

Thank you for your answers! I found a possible solution. As there would be no need for two way communication and no ROS on the arduino all i needed to do was basically pass three integers over the serial port. Turned out there was a much simpler way to do that, simply by importing the "Serial" library in the python script in ROS.

The transmitting end in python(ROS):

import serial

import time

arduino = serial.Serial(dev/ttyUSB0, 115200, timeout = 1)

time.sleep(2)

arduino.write(integer)

Receiving end on arduino:

if (Serial.available() > 0) {

Serial.read();

integer = Serial.parseInt();

}

Hope this can help others in the future.