Hello Everyone, I am using Arduino mega connect to a RS232-TTL convertor to control a pump, Kloehn V3 syringe pump. I post the code I used here but no response from Pump. Plus, when I press the initialization button as the manual said,the error led was lighting on, does anyone has any advice? Thanks advanced
!#include <SoftwareSerial.h>
SoftwareSerial Pump(2, 3); // RX, TX
void setup(){
Serial.begin(9600);
Pump.begin(9600);
while (!Serial) {} // Wait for serial port to connect (Needed for native USB port only)
delay(50);
Serial.println("Arduino is online!");
delay(1000);
Serial.println("Checking pump status...");
Pump.print("/1\r");
delay(1000); // Increased delay to allow the pump more time to respond
}
void loop(){
while (Pump.available()) {
Serial.write(Pump.read());
}
while (Serial.available()) {
Pump.write(Serial.read());
}
}
Hi, there is the data sheet and manual instrumentation of the pump, and the convertor I used I connect TX pin to pin2 of mega RX to pin3 of the mega, GND to GND, VCC to 5V.
You should not be using SoftwareSerial on a Mega which has several additional hardware serial ports and you should use one of them.
The Arduino Mega has three additional serial ports: Serial1 on pins 19 (RX) and 18 (TX), Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX).
Not all pins on the Mega and Mega 2560 boards support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).