apc220 and FSI1000A

Is it possibly to run SoftwareSerial with wire.h library for ACP220 and VirtualWire.h for FSI1000A together in the same Uno? When i write vw_setup(4000) my ACP220 running on serial2.begin(9600) stops.
How to do?

SoftwareSerial doesn't use the wire library. So, your question, as stated, can not be answered.

When i write vw_setup(4000) my ACP220 running on serial2.begin(9600) stops.

Almost certainly a software problem. Where IS your software?

When i enable the code vw_setup(4000); my Serial2 communication stops working...Can anyone help me?

Serial.begin(9600); // Initialize serial communications with Hostchannel
Serial2.begin(9600); // Initialize serial communications with ACP220
vw_set_tx_pin(9); // Pinne för TX
// vw_setup(4000); // Bits per sec for wireless

vw_set_rx_pin(6); // Sätt upp RX-Pin
vw_rx_start(); // Start the receiver PLL running

Can anyone help me?

No. Perhaps IF you posted links to the hardware and ALL of your code, then there might be a chance.

Which Arduino do you have? Serial2 suggests a Mega. If that is the case, why are you using SoftwareSerial?

OK, I am using Arduino Uno with this code:
Can you find any strange setup beside my newbe code :slight_smile:

// include the library code for liquid crystal and Virtualwire:
#include <SoftwareSerial.h> //
SoftwareSerial Serial2(10,11); // RX,TX för ACP220
#include <EEPROM.h> //
// #include <SPI.h> // RFID
#include <LiquidCrystal_I2C.h> //
#include <Wire.h> //
#include <VirtualWire.h> //
// LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
// initialize the library with the interface pins
// constants won't change. They're used here to set pin numbers:
const int RFIDpin = 2; // the number of the RFIDpin
const int UPPEpin = 3; // the number of the Uppepin
const int NEREpin = 4; // the number of the Nerepin
const int STOPpin = 5; // the number of the Stopppin
const int UPPpin = 7; // the number of the Upppin
const int NEDpin = 8; // the number of the Nedpin
const int Res1pin = 12; // the number of the Nedpin
const int Res2pin = 13; // the number of the Nedpin

int RFID = HIGH; //
int RFIDRX = LOW; //
int BOMUPPE = LOW;
int BOMNERE = LOW;
int NED = LOW;
int UPP = LOW;
int RET = LOW;
int NODSTOPP = LOW;
String Text1 = " Omstartad ";
String Lasttext = "Rad1";
//
byte index = 0; //
char indata[10]; //
char InChar; //
int Length;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize serial communication
Serial.begin(9600); // Initialize serial communications with Hostchannel
Serial2.begin(9600); // Initialize serial communications with ACP220
// Sätt upp LCD'ns antal kolumner och rader:
// lcd.begin(20,2); // initialize the lcd for 20 chars 4 lines and turn on backlight
//

vw_set_ptt_inverted(true); // Required for DR3100
vw_set_tx_pin(9); // TX
vw_setup(4000); // Bits per sec for wireless
vw_set_rx_pin(6); //
vw_rx_start(); // Start the receiver PLL running

// initialize digital pins.
pinMode(RFIDpin , INPUT_PULLUP);
pinMode(STOPpin , INPUT_PULLUP);
pinMode(UPPEpin , INPUT_PULLUP);
pinMode(NEREpin , INPUT_PULLUP);
pinMode(UPPpin , OUTPUT);
pinMode(NEDpin , OUTPUT);

}
// the loop function runs over and over again forever
void loop() {
//

//
if(Serial2.available() > 0) {
Length = Serial2.readBytesUntil('>',indata,10);
for (int i=0;i<Length;i++) {
Serial.print(" ");
Serial.print(indata*,HEX);*

  • Serial.print(" ");*
  • }*
    Serial.println();
    *// Skall bommen manövreras? *
  • if (indata[2] == 'B') { // Toggle bom command*
  • Serial.println("I will move Bom!");*
  • BOM(); }*
    //
  • if (indata[2] == 'C') { // Save cardID*
  • Serial.print("I will save cardID on "); *
  • newcard();*
  • }*
  • } *
    //
  • RFID = digitalRead(RFIDpin);*
  • BOMUPPE = digitalRead(UPPEpin);*
  • BOMNERE = digitalRead(NEREpin);*
  • NODSTOPP = digitalRead(STOPpin);*
    // set the cursor to column 0, line 0
    // (note: line 1 is the second row, since counting begins with 0):
    // lcd.setCursor(0, 0);
  • // lcd.print(" Bomstatus :");*
    //
  • if (NODSTOPP == LOW) {*
  • digitalWrite(NEDpin, HIGH); NED = LOW;*
  • digitalWrite(UPPpin, HIGH); UPP = LOW;*
  • Text1 = " Nodstopp ";}*
    //
  • if (BOMUPPE == LOW && BOMNERE == LOW) {*
  • digitalWrite(NEDpin, HIGH); NED = LOW;*
  • digitalWrite(UPPpin, HIGH); UPP = LOW;*
  • Text1 = "Granslagesfel!";}*
  • else {*
    //Har det detekterats RFID?
  • if (RFID == LOW || RFIDRX == 1)*
  • {*
  • RFIDRX=0;*
  • if (BOMUPPE == LOW) { digitalWrite(NEDpin, LOW); digitalWrite(UPPpin, HIGH); NED = HIGH; UPP = LOW;}*
  • else if (BOMNERE == LOW) { digitalWrite(UPPpin, LOW); digitalWrite(NEDpin, HIGH); UPP = HIGH; NED = LOW;}*
  • else if (BOMNERE == HIGH && BOMUPPE == HIGH && NED == HIGH) { digitalWrite(NEDpin, HIGH); digitalWrite(UPPpin, HIGH); RET = HIGH; NED = LOW;}*
  • else if (BOMNERE == HIGH && BOMUPPE == HIGH && NED == LOW) { digitalWrite(UPPpin, LOW); digitalWrite(NEDpin, HIGH); UPP = HIGH; NED = LOW;}*
  • }*

//

  • if (BOMNERE == HIGH && BOMUPPE == HIGH && RET == HIGH) { Text1 = " Returnerad ";*
  • Serial.println(Text1);*
    // lcd.setCursor(0, 1);
    // lcd.print(Text1);
  • delay(2000); *
  • digitalWrite(UPPpin, LOW); UPP = HIGH;*
  • RET = LOW; }*

//

  • if (BOMNERE == HIGH && BOMUPPE == HIGH) { Text1 = " Star Mellan ";}*
    //
  • if (UPP == HIGH && BOMNERE == HIGH && BOMUPPE == HIGH) { Text1 = " Gar Uppat ";}*
    //
  • if (NED == HIGH && BOMNERE == HIGH && BOMUPPE == HIGH) { Text1 = " Gar Nedat ";}*
    //
  • if (BOMNERE == LOW && BOMUPPE == HIGH) {digitalWrite(NEDpin, HIGH); NED = LOW; Text1 = " Nere "; }*
    //
  • if (BOMUPPE == LOW && BOMNERE == HIGH) {digitalWrite(UPPpin, HIGH); UPP = LOW; Text1 = " Uppe ";}*
  • }*
    //
    //
    // lcd.setCursor(0, 1);
    // print the number of seconds since reset:
    // lcd.print(millis()/1000);
    // lcd.clear();
    // lcd.print(Text1);
    //
  • if (Text1 != Lasttext) {*
  • Serial.println(Text1);*
  • Lasttext = Text1; }*
  • delay(1000);*
  • if (RET == HIGH) {*
  • delay(2000); }*
  • }*
    // ***********************************************************************
    void newcard(){
  • int pos = indata[3]-'0'; //*
    _ int k=pos*20;_
  • Serial.print("pos ");*
  • Serial.println(pos);*
  • for (int j=5 ; j<9 ; j++) {*
  • EEPROM.write(k,indata[j]);*
    // sendcard(); //
  • Serial.print(k);*
  • Serial.print(" EEPROM.read(k) ");*
  • Serial.print(EEPROM.read(k),HEX);*
  • Serial.print(" indata[j] ");*
  • Serial.println(indata[j],HEX);*
  • k++;*
  • }*
  • Serial.println();*
    }
    // ***************************
    void sendcard(){
  • Serial.print ("Nu skickas kortregistret till stolparna");*
    char* TXText="" ;
    TXText[0] = 'C';
    TXText[1] = 1; // Stolpens nummer (Adress for meddelandet)
    TXText[2] = indata[3]; // Detta är radnummer för ID
    TXText[3] = indata[5]; // ID0
    TXText[4] = indata[6]; // ID1
    TXText[5] = indata[7]; // ID2
    TXText[6] = indata[8]; // ID3
    // vw_send((uint8_t *)TXText, strlen(TXText));
    // vw_wait_tx(); // Wait until the whole message is gone
  • } *
    _// ***************************************************** _
    void BOM() {
    *// *
  • RFIDRX = 1;*
    }

Can you find any strange setup beside my newbe code :slight_smile:

Your improperly posted code? Does your code really look like that?

Your code should be posted in code tags. The icon on the top row, two to the right of the Tt icon, will generate the tags. Post your code between them.

The icon to the left of the one that looks like an envelope with a green circle on it will let you insert links. Use that to post links to your hardware.

YES! This is my code. The code runs perfect with this line
// vw_setup(4000); // Bits per sec for wireless
If i take away comment slashes // the Serial2.input stop working.
This will stop serial2.input
vw_setup(4000); // Bits per sec for wireless
I think it is related to VirtualWire and SoftwareSerial.
If I define baudrate for virtualwire my SoftwareSerial read stop working.

If you don't want to post links to your hardware, and you won't post your code properly, I give up trying to help you. Good luck.

PaulS:
If you don't want to post links to your hardware, and you won't post your code properly, I give up trying to help you. Good luck.

I'm sorry if i dont know how to post my code properly...I can read the code but maybe there is something else that i can not understand.
This is the Communication hardware i use:

And this:

OH, maybe the code is not readable with Swedish letters. :astonished:
I can try to take away the comments maybe it is more readable.
Is the code better presented now?

They would like you to click on "code" at the top right then insert all your code like this

also on your arduino IDE hit Ctrl plus T on your keyboard to format your code before posting it